miércoles, 8 de abril de 2020

Invocation code WaitAds for Push Notification

Invocation code
Invocation code is a piece of code that an ad server uses to serve ads. Each zone of every website on your Adserver.Online account has its own invocation code. In order to display ads, you need to place this code onto your website(s).

Invocation code example

<ins class="aso-zone" data-zone="34919"></ins>
<script data-cfasync="false" async="async" type="text/javascript" src="https://media.mywaitad.com/js/code.min.js">

This code works in an asynchronous mode, so it doesn’t block page loading.

Third-party clicks tracking
If you need to publish an invocation code in some 3rd-party ad system, you could use “data-redirector” parameter to configure clicks tracking.

You should examine 3rd-party documentation in order to find needed macros. For example, in Google DFP you should use %%CLICK_URL_UNESC%% macros.

<ins class="aso-zone" data-zone="xxx" data-redirector="%%CLICK_URL_UNESC%%"></ins>
<script data-cfasync="false" async="async" type="text/javascript" src="https://media.aso1.net/js/code.min.js">

Configuration
The codes (all at once) on a page can be configured using a special JS-code script placed in the HEAD section:

<script>
   var _aso = _aso || {};
   _aso.option1 = true;
   _aso.option2 = false;
</script>

Available options:

no_ad_dups – if true, then the same banner won’t be displayed on the same page more then one time. False by default.
no_campaign_dups – if true, then the campaign (any banners of it) won’t be displayed on the same page more then one time. False by default.
cmp – if true, then the invocation code will try to find the installed consent management platform (CMP) and retrieve visitor’s consent. Applied to GDPR only. False by default.
Please note, these parameters will work with normal invocation codes only. They will be ignored if you load ads programmatically using JS API (see below).

Custom attributes
If you need to pass some custom data to the ad serving engine for custom targeting or other purposes, you should use the following piece of JS-code in the HEAD section:

<script>
   var _aso = _aso || {};
   _aso.attr = {
     'tags': ['tag1', 'tag2', 'tag3'],
     'keywords': ['cats', 'dogs', 'monkeys'],
     'hb_bid': 10,
     'gender': 'male'
   };
</script>

There are reserved attributes’ names: refid, refid1, refid2, refid3, refid4, refid5, refid6, refid7, refid8, refid9. If you pass them, they will become available inside an ad server in a form of placeholders {refid}, {refid1}, {refid2}, {refid3}, {refid4},{refid5}, {refid6},{refid7},{refid8},{refid9}.

For example:

<script>
   var _aso = _aso || {};
   _aso.attr = {
     'refid': 'xxxxx',
     'refid1': 'zzzzz'
   };
</script>

Javascript API
Callbacks

Our invocation code supports two JS-callbacks. They have to be configured separately for each piece of code.

onload – will be called after the ad is shown
onempty – will be called in case of no ads
In order to configure callbacks you have to change your invocation code as shown:

<ins class="aso-zone" data-zone="xxx" data-onload="onloadCallback" data-onempty="onemptyCallback"></ins>
Corresponding JS function has to be defined:

<script>
  function onloadCallback(params) {
     console.log('Ad loaded:', params);
  }

  function onemptyCallback(idzone) {
     console.log('No ads for zone #'+idzone);
  }
</script>
Dynamic loading
You can load ads programmatically if normal invocation codes are not suitable for you for some reason. For example, if you want to show ads in a single page application.

To do that you should use “_ASO.loadAd” function.

Simple usage example:

_ASO.loadAd('el', 34919); // HTML ID, Zone ID
Calling with extra parameters:

_ASO.loadAd('el', 34919, true, { // HTML ID, Zone ID, async, params
  attr: {
    tags:['a', 'b'],
    keywords: ['cars']
  },
  onempty: 'onEmpty',
  onload: 'onLoad'
});
Check out the demo at https://adserver.online/demost/js_api.html

Passing parameters through an ad server to a landing page
We have a couple of scripts to help you to pass parameters from the URL where ads (banners) are displayed to a landing page on a visitor click.

1.  UTM labels

Firstly, you should add this snippet to the HEAD section of all the pages on your site:

<script type="text/javascript" src="https://media.aso1.net/js/tags/utm2attr.js"></script>

After that, UTM labels will be available inside an ad server in a form of special placeholders. You can insert them into the landing page URL on ads form.

Placeholders: {refid}, {refid1}, {refid2}, {refid3}, {refid4}.

2. Arbitrary parameters

Firstly, you should add this snippet to the HEAD section of all the pages on your website:

<script type="text/javascript" src="https://media.aso1.net/js/tags/subid2attr.js"></script>
After that, GET-parameters t1 … t10 will become available inside adserver in a form of special placeholders. You can insert them into the landing page URL on ads form.

Placeholders: {refid}, {refid1}, {refid2}, {refid3}, {refid4}, {refid5}, {refid6}, {refid7}, {refid8}, {refid9}.

Besides, you can add a special parameter to URL subid_param=xxx, for example, subid_param=subid. In this case, parameters having names subid1 … subid10 will be extracted from the URL instead of t1 … t10.

Please note, statistics are being collected for the first parameter only (refid). Therefore, refid1 to refid9 are considered passthrough parameters, so no statistics on them.

0 comentarios:

Publicar un comentario

Translate = traduce

Nuestros ultimos