Q&A
Mr. Pickles the AdPlugg Pug

Should the clickTag var be replaced when the HTML5 ad is served?

+1
0
-1

I have built a HTML5 ad so I can display a different image for different viewport widths which works fine.  Within the ad I define a `var clickTag="target url goes here";` which is used by my onclick handler.  I was under the impression that the value would be swapped out for the tracking url when the ad was served?  i.e. I expected an `adplugg.com....` url so clicks can be monitored.

<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
   <script type="text/javascript">var clickTag = "url goes here";</script>
        <style>...</style>

    </head>
    <body>
        <a
            class="ad-wrapper"
            rel="nofollow" target="_self" href="javascript:void(0)" onClick="window.open(clickTag, '_blank');"
            alt=""
        >
            <div class="ad-image"></div>
        </a>
    </body>
</html>

Many Thanks



Answers

+1
0
-1

I just tested it with your code and it works for me. You can try it by opening that ad in the preview and then after it opens, right click the ad and choose Inspect. From there you should be able to see that the "url goes here" text in your code has been replaced with code from the ad server. It uses JavaScript code instead of a URL fo facilitate passing in variables, caching, better performance, etc.