Setup
Schema update
For Panel-based as wel as Semantic contextual targeting, you'll need to update your runtime schema to add the following line in UserEvent type:
$url attribute needs to be populated with a proper URL in order to extract the contextual_key (URL without protocol nor query stings).
As well, ensure that the field ts in UserEvent is indexed:
For Semantic contextual targeting, and particularly if you want to create Audience segments based on semantic information, you'll need to add the following line in UserEvent type:
As well as the following types:
Contextual Targeting only works as of now with standard schema. Please reach out to your Account manager if you do not have UserEvent type in your schema.
Event rule
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:
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:
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.
Snippet installation
General
You need to add a new mediarithmics snippet dedicated to contextual targeting on every page where you want contexutal targeting to be performed. The mediarithmics contextual targeting snippet is made of two parts:
The configuration that you should fill according to your context (site token & snippet name)
A technical tag which contains the JavaScript code which asynchronously load the TAG in the page. This part should not be edited.
Here is an example of the contextual snippet you should implement:
You can find the site token, for each channel created, in Settings > Datamart > Channel.
The two common ways to integrate a tag are:
Through a universal tag container like Google Tag Manager or another similar solution. The code snippet must be copied once in a new tag and the tag container service automatically inserts the code wherever it is needed.
By inserting the code snippet in a general purpose template (ex: header template for an e-shop) which is used in all the web site pages.
Additional step for SPA
In case of a Single-page application, you will need to execute the following function whenever the URL change and, more exactly, on every page where you want contexutal targeting to be performed:
This call wil result in extracting the current URL to lookup associated Targeting lists and synchronize their IDs with configured activation platforms. Please make sure to call this function as soon as possible to ensure that the Targeting lists IDs are calculated before the auction is executed.
Last updated