Passing arbitrary data

Sometimes you may need to pass arbitrary data to the ad network.

You can do this with %EXTRA-*% macros in creatives and data-extra-* attributes on our <script> tags.

Add data-extra-* attributes to the master spot script tag. They apply to every ad loaded by that script.

<script defer async src="https://cdn2.tapioni.com/master-spot.js"
        data-extra-label="hello"
        data-extra-block-ad-types="101"
        data-extra-ex_av="0"
        data-extra-empty></script>
Attribute Request parameter Placeholder
data-extra-label="hello" data[EXTRA-LABEL]=hello %EXTRA-LABEL%
data-extra-block-ad-types="101" data[EXTRA-BLOCK-AD-TYPES]=101 %EXTRA-BLOCK-AD-TYPES%
data-extra-ex_av="0" data[EXTRA-EX_AV]=0 %EXTRA-EX_AV%
data-extra-empty data[EXTRA-EMPTY]= %EXTRA-EMPTY%

Suffixes are uppercased, with hyphens and underscores preserved. Parameter names and values are URL-encoded automatically; the table shows decoded parameters for readability. An empty attribute sends an empty value. If an attribute is absent, we'll leave its placeholder unchanged.

The same attributes can be placed on an individual ad script:

<script defer async src="https://cdn2.tapioni.com/asg_embed.js"
        data-spot="12345"
        data-extra-label="hello"
        data-extra-empty></script>

You may use this feature to integrate with the ExoClick AgeGo service.

Follow their instructions to set up AgeGo integration.

But instead of inserting ExoClick code into your page directly, do the following:

  1. Add ex_av=%EXTRA-EX_AV% and block_ad_types=%EXTRA-BLOCK-AD-TYPES% into creative codes/links in our admin area, for example:
<script async type="application/javascript" src="https://a.magsrv.com/ad-provider.js"></script>

<!-- Ad zones. XXXX and YYYYY correspond to the class and zone IDs provided by ExoClick. -->
<ins class="XXXX" data-zoneid="YYYYY" data-block-ad-types="%EXTRA-BLOCK-AD-TYPES%"  data-ex_av="%EXTRA-EX_AV%"></ins>
<script>(AdProvider = window.AdProvider || []).push({"serve": {}});</script>
  1. Read AgeGo values and send them via data-extra-ex_av and data-extra-block-ad-types attributes by injecting the master spot script dynamically:
<!--Code from AgeGo-->
<script src="https://verifycdn.agego.com/v1/verify.js"></script>

<!-- Code with custom functions-->
<!-- See https://docs.exoclick.com/publishers/exoclick-agego#how-to-create-a-sfw-experience for
     its content, provided by ExoClick documentation -->
<script src="main.js"></script>

<!-- Code to serve ads with the required params -->
<script>
    const script = document.createElement('script');
    script.src = '//cdn2.tapioni.com/master-spot.js'
    script.setAttribute('data-spot', '1');
    script.setAttribute('data-extra-ex_av', '2');
    script.setAttribute('data-extra-block-ad-types', '101');

    const agegoValue = getCookie("agego_aver");
    if (agegoValue !== false) {
        console.log("user verified");
        script.setAttribute('data-extra-ex_av', '1');
        script.setAttribute('data-extra-block-ad-types', '0');
    } else {
        console.log("user not verified");

        ['pointerdown', 'click', 'touchstart'].forEach(type => {
            document.addEventListener(type, intercept, {capture: true});
        });
    }
    document.body.appendChild(script);
</script>

This will affect only creatives that have %EXTRA-EX_AV% and %EXTRA-BLOCK-AD-TYPES% placeholders.