Skip to main content
Rayn Server-Side Implementation
Niels Baarsma avatar
Written by Niels Baarsma
Updated over a week ago

Rayn offers a set of APIs and batch services to allow for flexible integration in sites and apps. This guide describes the various services and possible integration flows. Head to the Rayn developer docs for more information.

Definitions

ContentId

A ContentId is used as a key to identify the content. The ContentId can be any static identifier that correlates to the unique content that Rayn should ingest, such as productId, listingId, hash of the page title or URL, whatever enables easy and unique identification of the web/app page, and allows retrieval of ContextIds from the API on server-side. RaynJS uses a hash of the selected content, but for server-side implementations, you are free to choose any type of identifier.

UserId

The UserId is used as a key to identify the user. The UserId is generated automatically when using RaynJS. In server-side implementations, any type of UserId can be used as long as it can be correlated with a user over the interactions with different content on the web page/app. The more persistent the UserId, the more accurately Rayn will be able to determine cohorts and personas.

Content Enhancement

Enhance content to expand the scope and body of content. This is applicable in situations where there may be very little content available for contextualization, or the content does not lend itself to contextualization. An example is a product listing with only the product name and a very short description. Rayn can run the selected content through a language model to expand the relevant scope of the content before contextualization.

Content Contextualization

As part of content processing, Rayn applies Natural Language Processing (NLP) models based on the Transformer architecture, which emphasizes self-attention mechanisms. These models are trained on extensive datasets to understand text and excel at comprehending context and nuances in language. After contextualization, Rayn maps the outcomes to IAB Content taxonomy.

Content Categories

Content categorization is a crucial element in Rayn’s approach to data organization and analysis. Rayn supports the following taxonomies to categorize content:

  • IAB content taxonomy 3.0

  • IAB content taxonomy 2.2

  • GARM classifiation (Beta)

Audience Cohort Categories

Standard Cohorts are interest-based cohorts that are generated automatically within Rayn, based on your first-party data. They use consistent, standardized behavior inputs and map to IAB Audience Taxonomy 1.1. These cohorts are the baseline generated by Rayn.

Persona IDs

Rayn Personas are dynamic targeting profiles used to enhance online advertising. They streamline the process by making targeting both straightforward and effective by grouping users based on a shared set of audience cohorts. Once a user is evaluated for one or multiple personas, they are assigned the respective Persona IDs.

API Keys

Rayn REST API's require an API key for authentication.

Connection ID

API keys and batch upload paths are always associated to a connection ID. Connections can be found in the management console in the left hand menu under Air -> Connections. Each connection in your account has a unique id which can be found in the URL of the respective connection.

Looking for API documentation? Check out the developer docs.

Services and API's

Batch Services

Content Ingestion

With the batch service for content ingestion, you can offer up content in a CSV for enhancement, contextualization, and categorization. Configuration of the batch service can be done in the Rayn Console. As part of the configuration, you will be able to specify the format of the CSV, which column to use as ContentId, and whether any of the columns should be used for further content enhancement. An AWS S3 bucket will be provisioned, the path, and key can be obtained from the Rayn Console. Files are processed hourly.

User Data Ingestion

Update user data with content consumption and first-party data.

APIs

User Events API

Rayn assigns user cohorts based on the consumption of content. The User Events API allows you to provide Rayn with the ContentIds that a user "consumed."

Get Context API

Obtain content categories for a given ContentId.

Put Context API

Put content data for near realtime contexualization.

Get UserData API

Obtain user CohortIds and PersonaIds.

Server-Side Implementation Flow Example

In this example, a publisher decides to create a server-side implementation rather than utilizing RaynJS. This guide describes how the flow could be implemented:

  1. A user opens the app/site.

  2. The publisher obtains a UserId or assigns a new UserId.

  3. The publisher calls the 'GetContextData API' sending the content ID for the applicable page to obtain content categories. The content categories can be used for contextual targeting.

    1. An alternative flow could be that the publisher retrieves content categories per ContentId in batch and maintains a local cache where they store the content categories.

  4. The publisher calls GetUserData with UserID to retrieve user cohorts and personaIDs based on user activity.

  5. As the user browses the app, the publisher sends the user events to the 'User Events' API. The API call should contain 'UserId' and one or multiple 'ContentId'. Rayn will ingest the new events for processing and return historical cohorts and personas for the user.

  6. The publisher caches the ContextIds, CohortIds, and PersonaIds and injects them into GPT for Google Ad Manager or Prebid using.

Note that every millisecond counts when generating the ad request. Aggressive caching strategies are highly advisable.

Screenshot 2024-05-06 at 11.15.12.png
Did this answer your question?