Skip to content
This repository was archived by the owner on May 5, 2026. It is now read-only.

On site ads cb81f4

Benjamin Diolez edited this page May 5, 2026 · 1 revision

Data collection / JavaScript / Campaigns / On-site ads

Foreword

Before starting implementation of the on-site ads plugin, please make sure you have initialised the AT Internet JavaScript Tracker and selected the plugin from the Tag Composer interface. To be sure to measure properly the Auto-Promotion campaign, please check if your campaign is declared in Settings > Marketing campaigns.

Principle

The objective is to measure clicks and impressions from on-site (self-promotion) campaigns, as well as campaigns displayed on your site for a third party, and then analyse this data.

Setting up the plugin

The on-site ads plugin can be set up within the Tag Composer interface. Two parameters are affected:

  • Automatic click management: When a click triggers navigation or redirection, browsers prohibit the measurement of these links. This management can force the measurement.
  • Automatic click management timeout: Period of time after which the automatic click management will force the navigation, even if measurement was not able to take place (in milliseconds).

Tagging

To tag your ads, the tracker exposes two features, publisher and self-promotion, depending on the type of ad to be measured.

These two features then expose three methods:

  • set: is used with the tracker’s dispatch method
  • add: is used with the tracker’s dispatch method
  • send: sporadic measurement of an ad

Publisher parameters

Property Description
campaignId Campaign name (ex: [label] or id[label]) (this parameter is mandatory).
creation Creative name (ex: ([label] or id[label])
variant Name of the variation (ex: ([label] or id[label])
format ID indicating the format (predefined or custom, ex: [120×40]) (see Appendix).
generalPlacement General placement (text ID predefined by us, to be formatted as [label]) (see Appendix).
detailedPlacement Details of the placement (ex: [label] or id[label])
advertiserId Advertiser ID (ex: id[label])
url URL linked (ex: [urlEncoded])

variant propertycan’t be used without creation**.** You must indeed define a creative name before adding variant.

Self-promotion parameters

Property Description
adId ID to be created in the Settings zone which characterises the group “campaign > category > creative > variation” (ex: id) (this parameter is mandatory).
format ID indicating the ad format (predefined or custom. ex: [120×40]) (see Appendix).
productId ID of associated product (subject to the SalesTracker option)

Undesired or unknown parameters can simply be removed from tagging; only “campaignId” and “adId” parameters are mandatory.

Optional parameters (only for send methods)

Property Description
elem Tagged DOM element
event JavaScript event (prevent event propagation) – since v5.7.0
callback Function to execute – since v5.7.0

Tagging an ad impression

var tag = new ATInternet.Tracker.Tag();
tag.selfPromotion.set({
   impression:{
      adId: 'id',
      format: '[60x60]',
      productId: 'id'
   }
});
tag.dispatch();
var tag = new ATInternet.Tracker.Tag();
tag.publisher.set({
   impression:{
      campaignId: 'id[label]',
      creation: 'id[label]',
      variant: 'id[label]',
      format: '[120x40]',
      generalPlacement: '[label]',
      detailedPlacement: 'id[label]',
      advertiserId: 'id[label]',
      url: '[urlEncoded]'
   }
});
tag.dispatch();

Tagging several ad impressions

50 impressions per page maximum

var tag = new ATInternet.Tracker.Tag();
tag.selfPromotion.add({
   impression:{
      adId: 'id',
      format: '[60x60]',
      productId: 'id'
   }
});
tag.selfPromotion.add({
   impression: {
      adId: 'id2',
      format: '[90x90]',
      productId: 'id2'
   }
});
tag.dispatch();
var tag = new ATInternet.Tracker.Tag();
tag.publisher.add({
   impression: {
      campaignId: 'id[label]',
      creation: 'id[label]',
      variant: 'id[label]',
      format: '[120x40]',
      generalPlacement: '[label]',
      detailedPlacement: 'id[label]',
      advertiserId: 'id[label]',
      url: '[urlEncoded]'
   }
});
tag.publisher.add({
   impression: {
      campaignId: 'id2[label2]',
      creation: 'id2[label2]',
      variant: 'id2[label2]',
      format: '[60x40]',
      generalPlacement: '[label2]',
      detailedPlacement: 'id2[label2]',
      advertiserId: 'id2[label2]',
      url: '[urlEncoded2]'
   }
});
tag.dispatch();

Examples with a form

<form action="url" method="get" onsubmit="return tag.selfPromotion.send({elem:this,click:{adId:'id',format:'[120x40]',productId:'id'}});" >
    <input type="submit" value="Submit" />
</form>
<form action="url" method="get" onsubmit="return tag.publisher.send({elem:this,click:{campaignId:'id[label]',creation:'id[label]',variant:'id[label]',format:'[120x40]',generalPlacement:'[label]',detailedPlacement:'id[label]',advertiserId:'id[label]',url:'[urlEncoded]'}});" >
    <input type="submit" value="Submit" />
</form>

Examples with JQuery event

Available since version 5.7.0

var tag = new ATInternet.Tracker.Tag();
$("#link").on( "click", function(event) {
    tag.selfPromotion.send({
        elem: this,
        click: {
            adId: 'id',
            format: '[120x40]',
            productId: 'id'
        },
        event: event
    });
});
var tag = new ATInternet.Tracker.Tag();
$("#link").on( "click", function(event) {
    tag.publisher.send({
        elem: this,
        click: {
            campaignId: 'id[label]',
            creation: 'id[label]',
            variant: 'id[label]',
            format: '[120x40]',
            generalPlacement: '[label]',
            detailedPlacement: 'id[label]',
            advertiserId: 'id[label]',
            url: '[urlEncoded]'
        },
        event: event
    });
});

Examples with click event

Available since version 5.7.0

var tag = new ATInternet.Tracker.Tag();
var link = document.getElementById('link');
ATInternet.Utils.addEvtListener(link, 'click', function (event) {
    tag.selfPromotion.send({
        elem: this,
        click: {
            adId: 'id',
            format: '[120x40]',
            productId: 'id'
        },
        event: event
    });
});
var tag = new ATInternet.Tracker.Tag();
var link = document.getElementById('link');
ATInternet.Utils.addEvtListener(link, 'click', function (event) {
    tag.publisher.send({
        elem: this,
        click: {
            campaignId: 'id[label]',
            creation: 'id[label]',
            variant: 'id[label]',
            format: '[120x40]',
            generalPlacement: '[label]',
            detailedPlacement: 'id[label]',
            advertiserId: 'id[label]',
            url: '[urlEncoded]'
        },
        event: event
    });
});

Examples with a form

<form action="url" method="get" onsubmit="return tag.selfPromotion.send({elem:this,impression:{adId:'id',format:'[120x40]',productId:'id'}});" >
    <input type="submit" value="Submit" />
</form>
<form action="url" method="get" onsubmit="return tag.publisher.send({elem:this,impression:{campaignId:'id[label]',creation:'id[label]',variant:'id[label]',format:'[120x40]',generalPlacement:'[label]',detailedPlacement:'id[label]',advertiserId:'id[label]',url:'[urlEncoded]'}});" >
    <input type="submit" value="Submit" />
</form>

Examples with JQuery event

Available since version 5.7.0

var tag = new ATInternet.Tracker.Tag();
$("#link").on( "click", function(event) {
    tag.selfPromotion.send({
        elem: this,
        impression: {
            adId: 'id',
            format: '[120x40]',
            productId: 'id'
        },
        event: event
    });
});
var tag = new ATInternet.Tracker.Tag();
$("#link").on( "click", function(event) {
    tag.publisher.send({
        elem: this,
        impression: {
            campaignId: 'id[label]',
            creation: 'id[label]',
            variant: 'id[label]',
            format: '[120x40]',
            generalPlacement: '[label]',
            detailedPlacement: 'id[label]',
            advertiserId: 'id[label]',
            url: '[urlEncoded]'
        },
        event: event
    });
});

Examples with click event

Available since version 5.7.0

var tag = new ATInternet.Tracker.Tag();
var link = document.getElementById('link');
ATInternet.Utils.addEvtListener(link, 'click', function (event) {
    tag.selfPromotion.send({
        elem: this,
        impression: {
            adId: 'id',
            format: '[120x40]',
            productId: 'id'
        },
        event: event
    });
});
var tag = new ATInternet.Tracker.Tag();
var link = document.getElementById('link');
ATInternet.Utils.addEvtListener(link, 'click', function (event) {
    tag.publisher.send({
        elem: this,
        impression: {
            campaignId: 'id[label]',
            creation: 'id[label]',
            variant: 'id[label]',
            format: '[120x40]',
            generalPlacement: '[label]',
            detailedPlacement: 'id[label]',
            advertiserId: 'id[label]',
            url: '[urlEncoded]'
        },
        event: event
    });
});

Wiki contents

Clone this wiki locally