Add macros to third-party ad tags

Add macros to third-party ad tags

Bidsopt DSP is compatible with a wide range of third-party ad servers. A number of click tracking and cache-busting macros can be used to allow these third parties to track clicks for creatives served through Bidsopt DSP

When you add a third-party ad tag to Bidsopt DSP, you’ll have to insert the macros yourself. Each third party tag looks a little different, but you can use the samples below as a guide.

What is a macro?

A macro is a placeholder (for example:$bo_click) that an ad server replaces with real value when the creative serves. Use macros in your tags when you want Bidsopt DSP to insert information into the tag in real-time.

For example, let’s say you’re using this third-party ad tag:
<script type="text/javascript" src="http://fanpixel.com?click="></script>

The third-party ad server expects a Bidsopt DSP click tracking URL after “click=“. To get this URL, insert a click tracking macro in the tag:
<script type="text/javascript" src="http://example.com?click=$bo_click"></script>

Each time the ad is served, the placeholder $bo_click is replaced with the actual click tracking URL from Bidsopt DSP.

Click tracking and cache-busting macros

Click tracking macros are the most commonly used type of macro. These macros allow third-party ad servers to track a click and associate it with the correct creative, line item, and auction in Bidsopt DSP. Clicking on a creative will first direct users to the Bidospt DSP ad server (to record the click and associated auction information) before redirecting them to the advertiser’s URL.

We also support additional macros depends on the advertiser purpose. The complete list of macros can be found here

Tag and macro examples

Celtra Tag

Before adding click macros:

<div class="celtra-ad-v3">
    <img src="data:image/png,celtra" style="display: none" onerror="
        (function(img) {
            var params = {'clickUrl':'','expandDirection':'undefined','preferredClickThroughWindow':'new','textColor':'#FFFFFF','barColor':'#000000','advertisementMessage':'Advertisement','scrollMessage':'Scroll to continue with content','useFullWidth':'1','offsetTop':'auto','offsetBottom':'auto','clickEvent':'advertiser','externalAdServer':'Custom','tagVersion':'html-standard-7'};
            var req = document.createElement('script');
            req.id = params.scriptId = 'celtra-script-' + (window.celtraScriptIndex = (window.celtraScriptIndex||0)+1);
            params.clientTimestamp = new Date/1000;
            params.clientTimeZoneOffsetInMinutes = new Date().getTimezoneOffset();
            params.hostPageLoadId=window.celtraHostPageLoadId=window.celtraHostPageLoadId||(Math.random()+'').slice(2);
            var qs = '';
            for (var k in params) {
                qs += '&amp;' + encodeURIComponent(k) + '=' + encodeURIComponent(params[k]);
            }
            var src = 'https://ads.celtra.com/95dbbd7f/web.js?' + qs;
            req.src = src;
            img.parentNode.insertBefore(req, img.nextSibling);
        })(this);
    "/>
</div>

After adding click macros:

<div class="celtra-ad-v3">
    <img src="data:image/png,celtra" style="display: none" onerror="
        (function(img) {
            var params = {'clickUrl':'$bo_click','expandDirection':'undefined','preferredClickThroughWindow':'new','textColor':'#FFFFFF','barColor':'#000000','advertisementMessage':'Advertisement','scrollMessage':'Scroll to continue with content','useFullWidth':'1','offsetTop':'auto','offsetBottom':'auto','clickEvent':'advertiser','externalAdServer':'Custom','tagVersion':'html-standard-7'};
            var req = document.createElement('script');
            req.id = params.scriptId = 'celtra-script-' + (window.celtraScriptIndex = (window.celtraScriptIndex||0)+1);
            params.clientTimestamp = new Date/1000;
            params.clientTimeZoneOffsetInMinutes = new Date().getTimezoneOffset();
            params.hostPageLoadId=window.celtraHostPageLoadId=window.celtraHostPageLoadId||(Math.random()+'').slice(2);
            var qs = '';
            for (var k in params) {
                qs += '&amp;' + encodeURIComponent(k) + '=' + encodeURIComponent(params[k]);
            }
            var src = 'https://ads.celtra.com/95dbbd7f/web.js?' + qs;
            req.src = src;
            img.parentNode.insertBefore(req, img.nextSibling);
        })(this);
    "/>
</div>

DV 360 Campaign Manager JavaScript tags

Before adding click macros:

<SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/adj/Nxxxx.site-keyname/Byyyyyyy;sz=widthxheight;dc_expa=URL;ord=[timestamp];dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=?"> 

After adding click macros:

<SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/adj/Nxxxx.site-keyname/Byyyyyyy;sz=widthxheight;dc_expa=URL;ord=$bo_cb;dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=$bo_click?">

DV 360 Campaign Manager i-frame/JavaScript tags

Before adding click macros:

<IFRAME SRC="https://ad.doubleclick.net/ddm/adi/Nxxxx.site-keyname/Byyyyyyy;sz=widthxheight;ord=[timestamp];dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=?" WIDTH=X HEIGHT=Y MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR='#000000'> 
<SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/adj/Nxxxx.site-keyname/Byyyyyyy;abr=!ie;sz=widthxheight;ord=[timestamp];dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=?"> 
</SCRIPT> 
</IFRAME> 

After adding click macros:

<IFRAME SRC="https://ad.doubleclick.net/ddm/adi/Nxxxx.site-keyname/Byyyyyyy;sz=widthxheight;ord=$bo_cb;dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=$bo_click" WIDTH=X HEIGHT=Y MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR='#000000'> 
<SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/adj/Nxxxx.site-keyname/Byyyyyyy;abr=!ie;sz=widthxheight;ord=$bo_cb;dc_lat=N;dc_rdid=Czzzz;tag_for_child_directed_treatment=I;kw=[keyword];click=$bo_click?"> 
</SCRIPT> 
</IFRAME>