The AdUnity Ad Tags consist of HTML code that can be placed into a publisher's Site or ad server. The AdUnity Ad Tags are then used to request ad impressions from our system.
Ad Tags are common in the digital display advertising industry. Ad tags are generally either JavaScript or HTML code that is put into a publisher’s Site or ad server for a variety of reasons (see below):
An AdUnity Ad Tag in its most simple form is defined by the following parameters:
The standard form of an AdUnity Ad Tag is the following:
<!-- AdUnity Ad Tag :BEGIN-->
<div class="au-tag"
data-au-account="XXXXXX" data-au-site="XXXX" data-au-zone="XXXX"></div>
<script src="//content.adunity.com/aulib.js" async></script>
<!-- AdUnity Ad Tag :END-->
All Ad Tags can be created using our Ad Tag Generator. More information can be found here.
In cases where the websites' design can accommodate multiple screen sizes (ie. mobile, tablets and PCs) without the use of a different hostname (eg. www.domain.com and m.domain.com), the Ad Tags can react depending on device / screen size and change the zone automatically to target accordingly.
For example, is the Ad Tag is configured with the data-au-zone=“rectangle” parameter, if the same Ad Tag is delivered on a mobile device, the parameter will change automatically to data-au-zone=“rectangle_mob”.
This feature is applied only for the following zones: "billboard", "top", "rectangle", "rectangle_2", "halfpage", "out-stream-video", "in-article", "next-article” and “special”.
ⓘNote
Note that this applies only on the aforementioned zones and not on theirs mobile counterparts (ie. will change “rectangle” to “rectangle_mob”, but not from “rectangle_mob” to “rectangle”).
The AdUnity Ad Tag can be further personalised using the following options:
Possible options are:
The Passback option is another advanced option of an AdUnity Ad Tag.
The Passback allows the system to run another script (ex: Google AdX/AdSense) when there is no ad available from AdUnity.
The following predefined option can be selected for the Passback function:
The following parameters must be filled in with the necessary values:
The standard form of an AdUnity Ad Tag with the passback option set to Google AdX/AdSense:
<!-- AdUnity Ad Tag :BEGIN-->
<div class="au-tag"
data-au-passback-fn="AU_Passback_ADX" data-au-passback-val='google_ad_client = "ca-pub-XXXXXXXXXXXXXXXX"; google_ad_slot = "XXXXXXXXXX"; google_ad_width = XXX; google_ad_height = XXX;'
data-au-account="XXXXXX" data-au-site="XXXX" data-au-zone="XXXX"></div>
<script src="//content.adunity.com/aulib.js" async></script>
<!-- AdUnity Ad Tag :END-->
The following parameters must be filled in with the necessary values:
The standard form of an AdUnity Ad Tag with the passback option set to Google Publisher Tag:
<!-- AdUnity Ad Tag :BEGIN-->
<div class="au-tag"
data-au-passback-fn="AU_Passback_GPT" data-au-passback-val='{"adUnitPath":"%%ADUNIT%%", "sizes":[[%%WIDTH%%, %%HEIGHT%%]], "targeting":{"exchange":["adunity"]}}'
data-au-account="XXXXXX" data-au-site="XXXX" data-au-zone="XXXX"></div>
<script src="//content.adunity.com/aulib.js" async></script>
<!-- AdUnity Ad Tag :END-->
The following parameters must be filled in with the necessary values:
The standard form of an AdUnity Ad Tag with the passback option set to AdServing Factory:
<!-- AdUnity Ad Tag :BEGIN-->
<div class="au-tag"
data-au-impression="$adf1.tag.impressionURI$"
data-au-click="$adf1.tag.clickURI$"
data-au-passback-fn="AU_Passback_ASF" data-au-passback-val='$adf1.tag.passbackValue$'
data-au-account="XXXXXX" data-au-site="XXXX" data-au-zone="XXXX"></div>
<script src="//content.adunity.com/aulib.js" async></script>
<!-- AdUnity Ad Tag :END-->
The following parameter must be filled in with the necessary values:
The standard form of an AdUnity Ad Tag with the passback option set to AdOcean:
<!-- AdUnity Ad Tag :BEGIN-->
<div class="au-tag"
data-au-passback-fn="AU_Passback_ADO" data-au-passback-val="ado-passback-id"
data-au-account="XXXXXX" data-au-site="XXXX" data-au-zone="XXXX"></div>
<script src="//content.adunity.com/aulib.js" async></script>
<!-- AdUnity Ad Tag :END-->
This option allows the user to insert custom code for the Passback function.
This option allows for a callback function to be called inside of the Ad Tag.
The following options are available for the Callback function:
<!-- AdUnity Ad Tag :BEGIN-->
<script>
//Custom callback function for AdUnity adTag
function CustomCallbackFunction(callbackData) {
/*
callbackData.adTagElement : [DOMelement] => the ad's container
callbackData.adWidth : [int] => the ad's width
callbackData.adHeight : [int] => the ad's height
callbackData.isOverlay : [bool] => flag that indicates if this ad is an overlayer
callbackData.value : [string] => value of "data-au-callback-val" attribute (use JSON.parse if sent as object)
*/
}
</script>
<div class="au-tag"
data-au-callback-fn="CustomCallbackFunction" data-au-callback-val='{"cbParam1": "abc", "cbParam2": 123}'
data-au-account="XXXXXX" data-au-site="XXXX" data-au-zone="XXXX"></div>
<script src="//content.adunity.com/aulib.js" async></script>
<!-- AdUnity Ad Tag :END-->
A custom trigger function ca be set for the Ad Tag.
The following options are available for the Trigger function:
<!-- AdUnity Ad Tag :BEGIN-->
<script>
//Custom trigger function for AdUnity adTag
function CustomTriggerFunction(triggerData, triggerFn) {
/*
triggerData.adTagElement : [DOMelement] => the ad's container
triggerData.value : [string] => value of "data-au-trigger-val" attribute (use JSON.parse if sent as object)
triggerFn : [function ref] => the ad's request trigger function (to be called only once)
*/
}
</script>
<div class="au-tag"
data-au-trigger-fn="CustomTriggerFunction" data-au-trigger-val='{"tgParam1": "abc", "tgParam2": 123}'
data-au-account="XXXXXX" data-au-site="XXXX" data-au-zone="XXXX"></div>
<script src="//content.adunity.com/aulib.js" async></script>
<!-- AdUnity Ad Tag :END-->
The Debug Console is a very useful tool when investigating Ad Tags. An example of the Debug Console can be seen below with a legend explaining the various options that it features.
Pressing the Tag Info button will open the Ad Tag information pane. Basic information like the AccountID, SiteID and ZoneID will be displayed alongisde other advanced information as Callback Function and Passback Function if available.
Pressing the Tag History button will open the Ad Tag history pane. A list of timestamped events will be presented to the user.
Pressing the Find Tag button will scroll the Ad Tag into view.