General setup

Schema update

For Panel-based as well as Semantic contextual targeting, you'll need to update your runtime schema to add the following line in UserEvent type:

contextual_key:String @TreeIndex(index:"USER_INDEX")

As well, ensure that the field ts in UserEvent is indexed:

ts:Timestamp! @TreeIndex(index:"USER_INDEX")

For Semantic contextual targeting, and particularly if you want to create Audience segments based on semantic information, you'll need to add the following lines in UserEvent type:

semantic_tagging:[SemanticTagging] @Property(path:"$properties.$semantic_tagging")
targeting_list_ids:[String] @TreeIndex(index:"USER_INDEX") @ReferenceTable(type:"CORE_OBJECT", model_type:"CONTEXTUAL_TARGETING_LISTS") @Property(path:"$properties.$targeting_list_ids")

As well as the following types:

type SemanticTagging  {
   provider_id:String @Property(path:"$provider_id") @TreeIndex(index:"USER_INDEX")
   provider_version:String @Property(path:"$provider_version") @TreeIndex(index:"USER_INDEX")

   entities:[SemanticEntity] @Property(path:"$entities")
   iab_categories:[SemanticIABCategory] @Property(path:"$iab_categories")
}

type SemanticEntity  {
   entity_id:String @Property(path:"$entity_id") @TreeIndex(index:"USER_INDEX")
   name:String @Property(path:"$name") @TreeIndex(index:"USER_INDEX")
   type:String @Property(path:"$type")
   wikidata_id:String @Property(path:"$wikidata_id")
}

type SemanticIABCategory  {
   category_id:String @TreeIndex(index:"USER_INDEX") @Property(path:"$category_id")
   name:String @TreeIndex(index:"USER_INDEX") @Property(path:"$name")
}

Event rule configuration

You need to add Contextual Targeting Extractor event rule to channels on which you want to use the contextual targeting feature. This event rule will have various objectives:

  • Specify which JavaScript tag will be responsible for URL & hit collection:

    • User event tag: uses the URL explicitly passed in the event

    • Contextual targeting tag: automatically captures the page URL from the browser

  • Calculate and add the contextual key in the event. This is done automatically when adding the event rule

  • Add the semantic information extracted from a URL in the event . This is required if you want to create Audience segments based on semantic information. Check Tag event with semantic extract in that case

  • Specify URLs (Blacklist URLs) or group of URLs (Blacklist RegEx) to blacklist. No semantic extraction nor targeting will be perfomed on those URLs. If we take the example of a news website, we recommend blacklisting pages that list articles, usually related to the same theme (e.g. "politics") and that are frequently refreshed.

Blacklist URL

Add a URL to blacklist per line. ALL URLs provided should NOT have protocol in it (http://, https://). For example:

Blacklist Regexp

Add a regexp to blacklist per line. Note that only * is authorized and * will automatically be applied before and after the input regexp. For example:

Will blacklist the following URLs:

  • www.mediarithmics.io/homepage

  • mediarithmicsTEST.io/homepage

  • mediarithmics*io/homepage/page.

Last updated

Was this helpful?