GAM MCM

Macros are special strings in creative code. Ad Manager later replaces this string with another value or code based on a creative’s settings. Macros are useful because you don’t have to directly update creative code if you need to make changes—you can update the macro reference.

For each macro, we’ve provided suggestions on how you might use it, but macros can be put to whatever uses are most valuable for you. Macros can be included in any code that’s processed by the ad server during delivery: third-party or custom creative code, Studio code, click-through URLs, or ad tags.

Important notes about macros

Case-sensitivity

Macros are case-sensitive. Use %%CACHEBUSTER%%, not %%Cachebuster%%.

Unescaped and escaped expansion

Unescaped and escaped macro versions expand differently. Learn how to use escaped and unescaped macros.

Macro insertion

Ad Manager inserts macros automatically for third-party creatives or VAST tag URLs if Ad Manager recognizes the third party. For custom creatives and creative templates, you need to add the macros manually. If you are unsure where to place a macro, contact your creative vendor.
When trafficking with a creative template, a Click-through URL input will only be present when a click macro is used in the template.

Rendering macros

Rendering macros are commonly used to render creatives, ensuring they look right and work correctly.

Ad Unit

The ad unit macro inserts the ad unit path from your Google Publisher Tag into the creative code when it is served.

Here’s how you would add the ADUNIT macro to a third-party creative code snippet:<script type="text/javascript">
document.write('<sc'+'ript type="text/javascript" src="http://www.3rdparty.com/?dfpAdUnit=%%ADUNIT%%"></scr'+'ipt>');
</script>

The ad unit macro expands to the full ad unit path contained in the original ad request, including the network code. Here’s an example of how the ad unit path would expand when the ad gets served:

<script type="text/javascript">
document.write('<sc'+'ript type="text/javascript" src="http://www.3rdparty.com/?dfpAdUnit=/1234/site/section"<>/scr'+'ipt>');
</script>

Destination URL Macro

MacroEscaping
%%DEST_URL_ESC%%Escaped
%%DEST_URL_ESC_ESC%%Double-escaped
%%DEST_URL_UNESC%%Unescaped

The destination URL macro expands to the creative’s click-through URL, which is either the line item’s click-through URL or an override set for the creative within the line item.

The destination URL macro is useful in custom creatives and creative templates. If the creative code needs to include the creative’s click-through URL, and the click-through URL changes as the creative or template is used across different line items, then this macro can help.

There are three click-through URL macros: escaped, double-escaped, and unescaped. Typically the amount of escaping (whether you include ESC once, twice, or not at all) depends on the third-party click-tracking company. Some third-party click-tracking companies require the URL to be escaped, while others do not. The level of escaping required by a third-party click-tracking company is often specified in the tag with the click= string in the third-party ad tag or custom creative code in Ad Manager:

  • click=: Escape it once (%%DEST_URL_ESC%%).
  • click0=: Don’t escape it (%%DEST_URL_UNESC%%).
  • click1=: Escape it once (%%DEST_URL_ESC%%).
  • click2=: Escape it twice (%%DEST_URL_ESC_ESC%%).

Ad Manager also supports %%DEST_URL%%, which does exactly the same thing as %%DEST_URL_ESC%%. We recommend using %%DEST_URL_ESC%% for clarity, but there’s no need to recode older creatives and templates.

If the template snippet contains the %u or %%DEST_URL%% macro, you’ll be directed to the xsd:string URL when you click on the creative. It has a maximum length of 1024 characters.

Tracking macros

Cachebuster (Random Number)

%%CACHEBUSTER%%

The cachebuster macro ensures that a fresh call is made to the ad server every time the code is executed, so you can count impressions accurately. If you don’t add the cache-busting macro to creative code, you’re more likely to see impression counting discrepancies between Google Ad Manager and a third-party ad server. Note that not all third parties require the cachebuster macro.

Most creative vendors will offer a placeholder in their tag to insert cache-buster macros. For example, if your third-party creative code contains something like this:

http://abc.3rd-party-serving.com/Targeting/;adServer.php?ab=cd&e=12fg=click&ord=[RANDOM_NUMBER]

You will want to select [RANDOM_NUMBER] and click Insert cachebuster macro so that it replaces the placeholder:

http://abc.3rd-party-serving.com/Targeting/adServer.php?ab=cd&e=12fg=click&ord=%%CACHEBUSTER%%

Select the standard ad tag and insert CACHEBUSTER macro to reduce the discrepancies when you use Campaign Manager 360 impression tracker for Ad Manager.

http://ad.doubleclick.net/ad/Nxxxx.site/Byyyy;sz=1x1;
ord=%%CACHEBUSTER%%?

Click Macros

MacroEscaping
%%CLICK_URL_UNESC%%Unescaped
%%CLICK_URL_ESC%%Escaped
%%CLICK_URL_ESC_ESC%%Double-escaped

The click macro expands to a special URL so you can track clicks in Ad Manager for third-party creatives. This macro is generally paired with the click-through URL of a creative in the anchor tag (<a>). Do not enter the click macro as the source of an image or iframe. Doing so results in a click being recorded every time the image or iframe renders, which is not legitimate and is filtered out as an invalid click. 

Use %%CLICK_URL_UNESC%% at the beginning of a link. Use %%CLICK_URL_ESC%% when the click-tracker is the parameter of another URL.

<a href="%%CLICK_URL_UNESC%%http://www.google.com">link</a>

<a href="http://www.google.com?rd_url=%%CLICK_URL_ESC%%">link</a>

Learn more about escaped and unescaped macros.

Verify your click macro implementation

An incorrectly-placed click macro won’t track clicks. Follow these steps to confirm that Ad Manager will record clicks as you intend.

  1. Preview the creative.
  2. Click on the preview.

Ad Manager displays a confirmation that clicks will be recorded. If you do not see this confirmation, your click macro is not implemented correctly.

, , , ,
You may also like
Latest Posts from GIGCONNECTS

Leave a Reply

Your email address will not be published. Required fields are marked *