Macros in Google Ad Manager (GAM) are values or short sections of code placed inside creative codes. To humans, they look like short phrases encased in double percentage signs, but when GAM reads them, it knows to run small sections of pre-defined code.

These macros can be placed inside the GAM tag, inside the creative tag (third party or custom creatives), or in click-through URLs. They take the format ‘%%MACRO_NAME%%’, and they are case sensitive. The common practice is to stick to uppercase letters in all macro names. Here are some macros every publisher needs to know that will surely make the task of optimizing their ads easier.

Macros

 

Destination URL

Three types of macros deal with destination URL: unescaped (%%DEST_URL_UNESC%%), escaped (%%DEST_URL_ESC%%), and double-escaped (%%DEST_URL_ESC_ESC%%). Which of the three you need usually depends on the third-party click-tracking company, but all three macros expand to insert the creative’s click-through URL.

The ‘click=’ string will often indicate the type to use: ‘click=:’ or ‘click1=:’ for escaped, ‘click0=:’ for unescaped and ‘click2=:’ for double-escaped.

Click

As with destination URL, click-through URL can be escaped and unescaped. %%CLICK_URL_UNESC%% goes at the beginning of a link after the href command. If the click tracker is part of the parameters of another URL, use the escaped macro as shown below:

<a href=”%%CLICK_URL_UNESC%%https://ift.tt/i8XBxZ3 text</a>

<a href=”https://ift.tt/PhTi5Ka%%CLICK_URL_ESC%%“>link text</a>

To verify in GAM, preview the creative and then click on its preview. GAM will display a confirmation if the macro is working.

View URL

To enable GAM to count when impressions are viewed rather than served, %%VIEW_URL_ESC%% or %%VIEW_URL_UNESC%% is used. This macro is intended for out-of-page creatives. You can deploy it in various ways, but Google recommends it should be deployed as follows:

<img src=”%%VIEW_URL_UNESC%%” style=”display:none”>

Upon viewing, the ad requests a dummy 1×1 image, which should be kept hidden to avoid distorting the page layout.

Height and width

These are useful when creating a template for a creative that you want to reuse. Instead of hard-coding the sizes into the creative, use %%HEIGHT%% and %%WIDTH%% for the sizes. The height and width are filled by the ‘Target ad unit size’ value defined in GAM.

Child-directed content

The macro %%TFCD%% (using the format ‘coppa=%%TFCD%%’) in a request will indicate to third parties that the request comes from a page with content intended for children, to help with compliance with the Children’s Online Privacy Protection Act (COPPA).

URI encoding

If you use a variable in your creative template whose value contains or could contain non-standard or reserved characters, the URI encoding macro will help you encode these characters. The best example is the landing page. If you were to pass a landing page containing query parameters (including ‘?’ or ‘&’) that URL might become corrupted, and the user might not be sent to the correct place. The format of this macro is slightly different. To encode the landing page, you would use ‘[%URI_ENCODE:landing_page%]’ where ‘landing_page’ is the name of the variable.

Cachebuster

The cache buster aims to reduce discrepancies in impression counting by ensuring that each time the creative sees a request, a new call is sent to the ad server (rather than a cached copy of a previous request). This macro is needed in cases where the third party’s code does not include such provision, but when it does, most third parties will consist of some indication of where the cache buster macro should be placed, if so desired.

The macro is written as %%CACHEBUSTER%% and will give the same random number to all events in that creative so that events can be tied to the same request/response.

Preview Mode

The preview mode macro &&PREVIEW_MODE%% will give a result of true if the creative is being shown in the preview mode of GAM, and false if not. Using this in the creative code stops the counting of preview impressions and artificially inflating the impression totals.

Video description URL

These macros expand to the description URL (typically identical to referrer URL).

Use %%DESCRIPTION_URL_ESC%% (single-escaped) when the macro is inside a URL and %%DESCRIPTION_URL_UNESC%% (unescaped) elsewhere.

Conclusion

Staying ahead of the competition is vital for publishers in this fast-paced AI world. By harnessing the power of Google Ad Manager macros, you can gain valuable insights into your ad performance, tailor your ad content to specific audiences, and optimize your revenue.

Remember to experiment with different macro combinations and continuously monitor your ad performance to stay on top of industry trends and changes. Doing so, you’ll be well-positioned to maximize your ad revenue and solidify your position in the ever-evolving AdTech landscape.

If you don’t understand nor want to spend time learning macros, why not let our ad ops specialists handle it all for you? We help hundreds of publishers to optimize their ad inventory for maximum ad revenue. Let us do the same for you. Sign up for a Professional account at MonetizeMore today!



source https://www.monetizemore.com/blog/google-ad-manager-macros-every-publisher-needs-to-know/