Activation setup

Contextual snippet installation

Setup

For website activation, you need to deploy a new mediarithmics snippet dedicated to Contextual targeting feature on every page where you want contexutal targeting activation to be performed. The mediarithmics Contextual targeting snippet is made of two parts:

  1. The configuration that you should fill according to your context (site token & snippet name)

  2. A technical part which contains the JavaScript code which asynchronously load the Contextual targeting tag on the page. This part should not be edited.

Here is an example of the Contextual targeting snippet you should implement:

<script type="text/javascript">
    /* YOU CAN EDIT THIS PART */
    const siteToken = "<SITE_TOKEN>" // token to change
    const snippetName = "ctMics" // snippet name that can be changed

    /* YOU SHOULD NOT EDIT THIS PART */
!function(e,t,s,i){"use strict";var a=e.ctscimhtiraidem||{};var r="call".split(" ");a._queue=a._queue||{},a._names=a._names||[],a._names.push(s),a._queue[s]=a._queue[s]||[],a._startTime=(new Date).getTime(),a._snippetVersion="ct-1.0";for(var n=0;n<r.length;n++)!function(e){var t=a[s]||{};(a[s]=t)[e]||(t[e]=function(){a._queue[s].push({method:e,args:Array.prototype.slice.apply(arguments)})})}(r[n]);e.ctscimhtiraidem=a,e[s]=a[s];e=t.createElement("script");e.setAttribute("type","text/javascript"),e.setAttribute("src",`https://events.mics-notrack.com/v1/sites/${i}/contextual_targeting.js`),e.setAttribute("async","true"),t.getElementsByTagName("script")[0].parentNode.appendChild(e)}(window,document,snippetName,siteToken);
</script>

You can find the site token, for each channel created, in Settings > Datamart > Channel.

  • The two common ways to integrate the snippet 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.

  • The snippet should be inserted in the <head> part of the web page. The code of the Contextual targeting snippet is non-blocking - it does not impact on the page rendering time.

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.

How it works

Contextual targeting tag will automatically:

  1. Identifies the URL browsed by an anonymous user

  2. Determines which targeting lists are associated to the URL

  3. Proceeds to key/value targeting with the configured activation platforms

Targeting list / URL API implementation

To enable mobile app activation, follow the steps below:

  1. Integrate our dedicated API to fetch the targeting lists associated with a given URL within your mobile app.

    1. Review the Signature Authentication documentation to learn more about how to autenticate when making API calls

    2. In the API response, you will receive an array of targeting_list IDs (id property in targeting_lists object). These IDs must be passed to the activation platform in the next step.

  2. Send the retrieved targeting_list IDs to the activation platform you are working with. Refer to the activation platform’s documentation for instructions on how to transmit these IDs.

Activation plaftorm specific setup

To enable activation on external platforms, follow the setup guide corresponding to each platform:

Last updated

Was this helpful?