Q&A
Mr. Pickles the AdPlugg Pug

How to add a timestamp to an impression tag

+1
0
-1

My client has sold advertising space to a third party who has provided a click tag which works fine.

The third party has also supplied three forms of the impression tag which I cannot get to load. From reading their notes it may be the timestamp that needs setting (or possibly a randomly generated number to replace it) but not sure how to apply that in the Adplugg environment.

3 impression tags:     (1)  image     (2)    iframe    (3)     JavaScript

I'm guessing that I need to use the 'Custom' ad type. Am I right?
Also, how do I add either the timestamp or the RNG to complete the script?

Here is an example (anonymised)

<IMG SRC="https://ad.doubleclick.net/ddm/trackimp/Nnnnn.nnnnnnnDxxxxxxxxxxxxxxP1/B...ord=[timestamp];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=?" BORDER="0" HEIGHT="1" WIDTH="1" ALT="Advertisement">

The error given is "Your src must be a valid URL"



Answers

+1
0
-1

Yes, use the "Custom" ad format and just paste the below JavaScript code (or something similar) at the bottom:

<script>
// Add the impression tag.
(function(){
    var img = document.createElement('img');
    img.src = 'https://ad.doubleclick.net/ddm/trackimp/Nnnnn.nnnnnnnDxxxxxxxxxxxxxxP1/B...' + (new Date().getTime()) + ';dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=?';
    img.border = 0;
    img.height = 1;
    img.width = 1;
    img.alt = 'Advertisement';
    document.body.appendChild(img);
})();
</script>

This JavaScript code creates the image tag to match your example above and inserts it at the bottom of the body tag. Note that it adds the timestamp using (new Date().getTime()).

If they've already provided you with a JavaScript version, you could maybe just use that instead as it likely does the same thing as the above code. I'd opt for using the version from the advertiser if possible.

Thank you for the quick response.... at least I got the 'Custom' ad format right! I have tried using your suggested code (with the valid values added back in of course) and I have tried editing the advertiser's JavaScript impression tag and adding in the getTime function. I am happy to use their code as you suggest but my lack of knowledge has prevented me from adding the function into a location where it works. The good news is that the ad now saves. Unfortunately it does not perform, however: 1) the 'creative' column on the ad list in AdPlugg just shows a Preview of the image rather than a thumbnail -- maybe that's a feature of the Custom format?; 2) the image shows up in the right place on the test page (staging site) but is half size; 3) the cursor changes to a zoom button (magnifying glass with + inside) when it hovers over the image; 4) the zoom works! so the image increases in size when pressed and does nothing more; All this demonstrates is my lack of JavaScript skill! Here is the advertiser's JavaScript code. Can the getTime function be included within this or does it exist as a function in its own right below? <SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/trackimpj/Nnnnn.nnnnnnnDxxxxxxxxxxxxxxxxP1/Bnnnnnnnn.nnnnnnnnn; dc_trk_aid=nnnnnnnnn; dc_trk_cid=nnnnnnnnn; ord=[timestamp]; dc_lat=; dc_rdid=; tag_for_child_directed_treatment=; tfua=?"> </SCRIPT>
Ah, now that I've seen the JavaScript version that they provided, I can see that it would have the same timestamp issue as the img tag one. I'd recommend that you use the JavaScript solution that I provided as it will set the timestamp.