Building a Purple Experience
Advertisment

Embedded ads in Experience

4min

There are two ways to create embedded ads in Experience:

  1. Using Data Sources
  2. Using a Content Body Component

1. Using Data Sources

The embedded ad feature allows you to insert ads between elements at specific positions within your data source. You can configure this feature using the 'ad' field. By enabling the 'ad' field, you can set up embedded ads with the following configurations:

  • adId : The ID of the ad to be displayed.
  • Interval : The number of elements between each ad display.
  • After : The number of elements to display before starting to show embedded ads.
  • Indexed : If set to true, the ad ID of embedded ads will follow the structure adId-index, where index represents the number of embedded ads already inserted (default is 0).
  • startIndex : Specifies a custom start index instead of the default value of 0.

Example

In this example, the first embedded ad will start displaying after 2 contents. Its ID will be traffective-5. The second ad will be displayed after 3 more contents, and its ID will be

traffective-6, and so on.

Document image


2. Using a Content Body Component

This method allows you to insert ads based on the amount of content in the root level of a content body. To configure this, you can use the embeddedAd field with the following settings:

  • adOffsetUnit: Defines the unit for displaying the embedded ad. Possible values are:
    • WORD
      : After a specified number of words.
    • PARAGRAPH
      : After a specified number of paragraphs.
    • LETTER
      : After a specified number of letters.
  • ADS: Configure the ad to display here, including:
    • adConfig
      : Settings for the ad component to display.
    • counter
      : Specifies the number of units (WORD, CHARACTER) after which an ad should be displayed.
    • Indexed: If set to true, the ad ID will be named based on the index, resulting in an ID structure of identifier + index. Defaults to 0.
    • startIndex: If Indexed
    • is set to true, this defines the starting index.

Any ad is always inserted between paragraphs. Example: if you set the value for "word" to "1", the ad will not be inserted after the first word, but after the first paragraph.

Inside Content Body Component, ads are inserted on the topmost level to prevent interchange with other elements that might contain paragraphs, like Blockquotes and Figures. Tose will be ignored whed counting Paragraphs, too.

Example

In this example, the first embedded ad will be displayed after 1000 words (just after the paragraph when reaching 1000 words). Its ID will be traffective-3. The second ad will be displayed after another 1000 words, with its ID being traffective-4, and so on. The maximum number of ads to be displayed is 20.a

Document image