Developers » AS2 tagging » JavaScript » Campaigns » On-site ads
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 property can’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();
Tagging an ad click
Examples with a link
<a href="url" onclick="return tag.selfPromotion.send({elem:this,click:{adId:'id',format:'[120x40]',productId:'id'}});" >Link</a>
<a href="url" onclick="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]'}});" >Link</a>
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 }); });
The “elem:this” and “event:event” parameters are used for automatic click management, just remove them to disable this management on the link.
Tagging an ad impression on click
Examples with a link
<a href="url" onclick="return tag.selfPromotion.send({elem:this,impression:{adId:'id',format:'[120x40]',productId:'id'}});" >Link</a>
<a href="url" onclick="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]'}});" >Link</a>
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 }); });
The “elem:this” and “event:event” parameters are used for automatic click management, just remove them to disable this management on the link.
Appendix
Appendix: formats
- 468: classic format (468×60)
- sky320: skycrapers format (160×320)
- sky600: skycrapers format (160×600)
- rect180: rectangle format (180×150)
- rect300: rectangle format (300×250)
- rect336: rectangle format (336×280)
- wide: wide format banner (728×90)
- vert240: vertical format banner 120×240
- vert600: vertical format banner 120×600)
- square: square format banner (250×250)
- popup: popup format
- popund: popund format
- 16-9: 16:9 format (320×180)
- Inter: interstitial format (800×600)
- maxwid: Maxi leaderBoard format (985×110)
- intext: intext format
- 0: others
You can specify any other custom format using the following nomenclature: “[name]”.
Example : you may set a label : [button], or a size : [120×40].
Appendix: placements
- GT: General Turnover
- HP: Home Page (only on home page)
- PHP: Pre-HomePage
- 0: others