Macros

Include macros in any code that's handled by an ad server during delivery. You can update the macro reference so you don't have to update the creative code. #macros

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.
  • Reserved characters and URL encoding (percent encoding)
    Ad Manager reserves certain lowercase letters preceded by a percentage:

    %a
    %c
    %h
    %i
    %n
    %p
    %k

    These strings should not be used in URL encoding as they can interfere with macro expansion.

  • Macros aren't supported for Programmatic Direct
    See the available features for Programmatic Direct.

Expand all  Collapse all

Rendering macros

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

Ad unit
 
Macro
%%ADUNIT%%
 

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://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://3rdparty.com/?dfpAdUnit=/1234/site/section"<>/scr'+'ipt>');
</script>

This macro only works for approved suggested ad units. If a suggested ad unit is at the third level, this macro only expands to the second-level ad unit when used in the creative snippet. Once the suggested ad unit is approved, the macro expands to the third ad unit level in the creative snippet

Destination URL
 
Macro Escaping
%%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.
File server
 
Macro
%%FILE:file_display_name%%
 

The file server macro %%FILE:file_display_name%% expands to the full URL of a creative asset that has been uploaded for a creative. Use this macro to call uploaded assets, such as an image, with custom creative code.

To use this macro, replace file_display_name with the display name of the creative asset, as it's shown in Ad Manager when you view the creative details.

Height and width
 
Macro
%%HEIGHT%%
%%WIDTH%%
 

These macros insert the creative height and width, as defined in Ad Manager by the creative's "Target ad unit size" field value, into the custom code of a creative during the ad serving process.

The height and width macros can be especially useful if you're creating a creative template that you want to reuse with creatives of different sizes. Instead of hard-coding the size for each creative, you can let the height and width macros insert the values into each creative dynamically.

Pattern match
 
Macro
%%PATTERN:key%%
%%PATTERN:TARGETINGMAP%%
%%PATTERN:url%%
 

Use the pattern match macro to pass one or more custom variables such as a targeting value into a creative. You can use this macro to pass key-values, replace the entire targeting string, or expand the referrer URL. This can be helpful if you want to serve different creatives based on information you know about a user, such as a user's content preferences.

The pattern match macro is limited to 100 replacements per creative.

Escaping the pattern match macro

The pattern match macro returns the value as received. If you are using the macro in one of the URL fields, such as the "VAST tag URL" or "Third-party tracking URL" field in a video creative, you may want the expanded value to return escaped. To do this, you need to triple-escape the value in the request.

%%PATTERN:key%%

For example, you have two creatives for a given line item: one that was designed to appeal to female users and one that was designed to appeal to male users. The "key" used in the macro must be alphanumeric characters or the underscore (_).

Here is how the process works:

  1. You're passing the custom value (in this case, user's gender) into an ad tag on your page using key-values:
    googletag.defineSlot("/1234/adunit1/adunit2", [728, 90], "div-gpt-ad-123456789-0")
    .addService(googletag.pubads())
    .setTargeting("gender", "male");
  2. In the custom or third-party creative, dynamically pass the custom value (user's gender) using the following macro: <some creative script here>...&gender=%%PATTERN:gender%%
  3. The entire macro of %%PATTERN:gender%% will be replaced with "male".
  4. Ad Manager will call and serve the “male” creative file to this user.

%%PATTERN:TARGETINGMAP%%

You can use %%PATTERN:TARGETINGMAP%% to replace the entire targeting map and dynamically create passback tags.

Here's how you would add the TARGETINGMAP macro to an ad tag:

.updateTargetingFromMap(%%PATTERN:TARGETINGMAP%%).display();

Here's an example of the complete key-value string when the ad gets served:

.updateTargetingFromMap({"key1":["value1"], "key2": ["value2","value3"]}).display();

  Sample passback tag between two Ad Manager networks

You can use this macro to set up a passback tag between two Ad Manager networks ("Network A" and "Network B").

Here is a sample creative booked in Ad Manager Network A:

<script type='text/javascript' src='http://googletagservices.com/tag/js/gpt.js'>
googletag.pubads().definePassback('/network_B/Homepage', [468, 60])
 .setTargeting("myAdUnit", "%%ADUNIT%%")
 .updateTargetingFromMap(%%PATTERN:TARGETINGMAP%%)
 .display();
</script>

In case Ad Manager Network B does not have any sold campaign to serve, it can give the impression back to Network A using a passback creative such as the following:

<script src='//googletagservices.com/tag/js/gpt.js'>
googletag.pubads()
 .definePassback('%%PATTERN:myAdUnit%%', [468, 60])
 .updateTargetingFromMap(%%PATTERN:TARGETINGMAP%%)
 .setTargeting("kwd", "noloop") // to avoid infinite loops
 .display();
</script>
Sample passback tag between Ad Manager and a third-party ad server

You can also use TARGETINGMAP in a passback tag that gets sent in a request to a third-party ad server, enabling you to have multiple values in a dynamic creative.

Here is a sample creative booked in Ad Manager:

<script type="text/javascript">
document.write('<sc'+'ript type="text/javascript" src="http://3rdparty.com/generatePassback.php?dfpAdUnit=%%ADUNIT%%&targeting='+encodeURIComponent(JSON.stringify(%%PATTERN:TARGETINGMAP%%))+'"></scr'+'ipt>');
</script>

When served by Ad Manager, this expands to:

<script type="text/javascript">
document.write('<sc'+'ript type="text/javascript" src="http://3rdparty.com/generatePassback.php?dfpAdUnit=/network_A/first_level_ad_unit/second_level_ad_unit&targeting=%7B%22kw%22%3A%5B%22testpercentp%22%5D%7D"></scr'+'ipt>');
</script>

The third party now has access to the dynamically generated “dfpAdUnit” and “targeting” parameters and can build the following passback:

<script src='//googletagservices.com/tag/js/gpt.js'>
googletag.pubads()
 .definePassback('/network_A/first_level_ad_unit/second_level_ad_unit', [728, 90])
 .setTargeting("kw", "noloop") // to avoid infinite loop (see https://google-support.mirrorblogs.com/admanager/answer/2811375)
 .updateTargetingFromMap({"kw":["testpercentp"]}).display();
</script>

To do that, the third party may be given a template code that looks something like this:

myTargetingObject = JSON.parse('$targeting'); document.write('<sc'+'ript src="https://googletagservices.com/tag/js/gpt.js"></scr'+'ipt>');
document.write('<scr'+'ipt>');
  callback = function() {
    googletag.pubads().definePassback('$dfpAdUnit', [728, 90])
    .setTargeting("kwd", "noloop")
    .updateTargetingFromMap(myTargetingObject)
    .display();
  };

  window.googletag = window.googletag || {};
  googletag.cmd = googletag.cmd || [];
  googletag.cmd.push(callback);

document.write('</sc'+'ript>');

%%PATTERN:url%%

You can also use the reserved key url to expand to the URL of the referring page.

Note that url is a reserved key; any key-values in your Campaign Manager 360 tags that have url as the key name will be overwritten with the referrer URL.

Tag parameter
 
Macro
%%TAG_PARAM%%
 

The tag parameter macro is used in conjunction with other ad tag parameters, and is only available to be used with the following parameters:

Where supported, it expands to the value of the parameter.

For example, %%TAG_PARAM:correlator%% (supported) expands to the value of correlator from the ad tag, but %%TAG_PARAM:ppid%% (unsupported) does not expand to any value.

Target in new window
 
Macro
%%TARGET_IN_NEW_WINDOW%%
 

The target in new window macro indicates whether the target window setting specified for the ad unit where a creative is served is "_blank" (new window) or otherwise.

  • If the target window is _blank, the macro expands to 1.

  • If the target window is any other value, or if no target window is specified, the macro expands to 0.

Use the %%TARGET_WINDOW%% macro if you want to insert the actual target window setting value.

Target window
 
Macro
%%TARGET_WINDOW%%
 

The target window macro expands to the target window specified for the ad unit where a creative is served. You can use the macro within the code of a creative to specify whether a click on the creative will take the user to a new window or load the landing page in the same window, depending on the settings for each site where users will see the ad.

For example, the AdManager_News.com ad unit has the target window set to _top and the AdManager_Fashion.com ad unit has it set to _new. If the %%TARGET_WINDOW%% macro is included in the creative's code, it will expand to _top for users at AdManager_News.com and _new for users of of AdManager_Fashion.com.

Here's an example implementation:

<a href="%%CLICK_URL_UNESC%%%%DEST_URL%%" target="%%TARGET_WINDOW%%"><img src="my ad"></a>

Use the %%TARGET_IN_NEW_WINDOW%% macro if you want to determine whether the target window setting value is "_blank" or another value.

Tag for child-directed content
 
Macro
%%TFCD%%
 

The tag for child-directed content (TFCD) lets you to let third parties know that a given ad request comes from a page with child-directed content. The macro is intended to assist in compliance with the Children's Online Privacy Protection Act (COPPA).

You can include the macro in any redirects or requests for third-party creatives, in the format coppa=%%TFCD%% or something similar. It can also be used in JavaScript to set GPT passback tag requests for child-directed treatment. The macro expands to 1 for child-directed content, or 0 for other content, based on information about the nature of the page, site or mobile app that sent the request to Ad Manager.

If you are using Google's advertising services and would like to implement child-directed treatment at the site or app level, please see Tag a site or app for child-directed treatment.

URI encoding for creative templates
 
Macro
[%URI_ENCODE:variable%]
 

The URI encoding macro correctly translates spaces and other special characters in creative template variable values for use in URIs, also known as URLs.

This macro only works with creative templates, not with custom or third-party creatives, and doesn't double-encode characters that have already been encoded.

Example

Let's say your creative template has a "list" variable called "Color" with two values: "dark blue" and "light green". By default, Ad Manager adds [%Color%] to your creative template snippet:

<a href="https://paint.com/wall.html?color=[%Color%]">Paint!</a>

When the creative is created, Ad Manager replaces [%Color%] with the literal text string of the selected list item. In this example, the literal text strings contain space characters and will break the URL since space characters need to be encoded. Use [%URI_ENCODE:Color%] to avoid this problem.

<a href="https://paint.com/wall.html?color=[%URI_ENCODE:Color%]">Paint!</a>
 

[%Color%] dark blue
[%URI_ENCODE:Color%] dark%20blue

This macro is especially helpful when using a creative template variable to define a click-through URL or redirect URL. Without correct encoding, the full URL in your creative might not function.

Example

Let's say your creative template has a "URL" variable called "LandingPage". By default, Ad Manager adds [%LandingPage%] to your creative template snippet:

<a href="%%CLICK_URL_UNESC%%[%LandingPage%]">Click here!</a>

If the [%LandingPage%] URL contains query parameters, such as ?page=home&sport=baseball, the URL becomes malformed and the redirect won't work as it should. In this example, the content after the ampersand (&) will be attributed to the full URL rather than the redirect URL. Use [%URI_ENCODE:LandingPage%] to avoid this problem.

<a href="%%CLICK_URL_UNESC%%[%URI_ENCODE:LandingPage%]">Click here!</a>
 

[%LandingPage%] https://mysportswebsite.com?
page=home&sport=baseball
[%URI_ENCODE:LandingPage%] https%3A%2F%2Fmysportswebsite.com%3F
page%3Dhome%26sport%3Dbaseball

Tracking macros

These macros are most commonly used for tracking and reporting purposes.

Cachebuster (random number)
 
Macro
%%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%%?

The cachebuster macros in VAST responses

The %%CACHEBUSTER%% macro expands to the same random number for all events in a given creative. This is particularly useful for video ads, since the macro expands to the same random number for every video tracking event in a VAST response.

Click
 
Macro Escaping
%%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://google.com">link</a>

<a href="http://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.

Expand
 
Macro What it expands to
%eaid! Line item ID
%eadv! Advertiser ID for the line item being served
%ebuy! Order ID for the line item being served
%ecid! Creative ID
%eenv! Environment (tag type) indicator: i for iframe, j for JavaScript
%epid! ID of the ad unit where the line item is being served
%esid! ID of the highest-level ad unit above the ad unit where the line item is being served
This is a legacy macro and may not work as expected with your network.
 

Use the expand macros within custom creative code or in a click-through URL to display ID values from Ad Manager when serving a creatives to a page. This is often used to match IDs from Ad Manager with IDs in a publisher's own database for troubleshooting or other reporting.

Expand macros can be separated from one another in the click-through URL with any character that is safe for use in Ad Manager click-through URLs. For example, http://site.com/?%eaid!;%ecid! expands to http://site.com/?1234567;4265598.

Device ID
 
Macro
%%ADVERTISING_IDENTIFIER_PLAIN%% (the device identifier)
%%ADVERTISING_IDENTIFIER_TYPE%% (the device type)
%%ADVERTISING_IDENTIFIER_IS_LAT%% (the Limit Ad Tracking setting)
 

The %%ADVERTISING_IDENTIFIER_PLAIN%% macro allows in-app publishers to send a resettable device ID to advertising partners for serving interest-based ads. This makes it easier for you to give resettable device ID access to your advertisers and agencies.

In-app publishers can also use the %%ADVERTISING_IDENTIFIER_TYPE%% macro to send the type of device, and the %%ADVERTISING_IDENTIFIER_IS_LAT%% macro to send the Limit Ad Tracking (LAT) setting, which indicates the Limit Ad Tracking signal from a device.

Learn more about resettable device IDs for user targeting, which includes the supported device types.

Prerequisites

Set HTTPS encryption for creatives. This is a requirement for both the creative as well as any third-party pixels that you use for conversion tracking. If creatives aren't encrypted for HTTPS, or if you override automatic SSL compatibility, the macro will not expand the value, but the creatives will still serve.

How it works

  1. In Ad Manager, the publisher includes the macros in their creative and/or tracking URLs.
  2. The macros expand to have the device ID of the user, device type and/or LAT setting, which are then included in the creative as they make calls to the third party.

    The identifier macro won't expand if the ad request is from a child-directed app (TFCD) or if Limit Ad Tracking (LAT) is activated. In these cases, this macro returns an empty string ("").

Format

This macro sends a 32 uppercase hexadecimal digits value, displayed in five groups and separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and four hyphen).

Example: 201F2EB1-8041-9E39-CD07-FCBBA5A29B41

See the possible values for supported device types and Limit Ad Tracking (LAT).

Preview mode
 
Macro
%%PREVIEW_MODE%%
 

Use the preview mode macro in custom creative code to prevent counting of preview impressions by your backend systems or third-party systems. The macro expands to true if the creative is being viewed as an Ad Manager preview, false if it's a regular impression.

Scheme
 
Macro
%%SCHEME%%
 

The scheme macro expands to http: or https:, whichever matches the security scheme of the webpage where a creative is being served. You can put it at the beginning of a URL.

<img src=%%SCHEME%%//website.com/img/logo.gif>

Site
 
Macro
%%SITE%%
 

Expands to the domain of the URL parameter in an ad tag (for example, google.com). The macro can be used to modify your creative based on where the request came from. It doesn't work on AdExchange ads that are marked as anonymous.

Viewed impression
 
Macro Escaping
%%VIEW_URL_ESC%% Escaped
%%VIEW_URL_UNESC%% Unescaped
 

The viewed impression macro lets Ad Manager to count an impression each time a creative is downloaded in the user's device and has begun to load. Only use this macro in out-of-page creatives.

There are multiple ways to send a view ping. We recommend using an <img> tag:

<!-- This img tag is invisible. It makes the browser send a request to the VIEW_URL. -->
<img src="%%VIEW_URL_UNESC%%" style="display:none">

<!-- This img tag shows the real ad.-->
<img src="[%Imagefile%]" border="0">

The first <img> tag retrieves a 1x1 image from VIEW_URL. Set the style to “display:none” so that it is hidden and doesn't affect the layout of the page.

Ad request macros for GDPR

These macros are most commonly used with ad requests that are subject to GDPR.

GDPR
 
Macro
${GDPR}
 

Expands to the value of gdpr= associated with the request

Transparency & Consent (TC) string
 
Macro
${GDPR_CONSENT_XXXX}
 

Expands to the Transparency & Consent (TC) string associated with the request. If the Transparency & Consent (TC) string is blank or invalid, this macro will not expand. Use this macro to pass the TC string to a third-party creative provider in a URL in non-programmatic creatives.

Replace "XXXX" with the IAB GVL ID of the third-party provider. If the TC string is blank or invalid, this macro will not expand.

Creatives with the ${GDPR_CONSENT_XXXX} macro may become blocked if the third-party provider associated with the IAB GVL ID you inserted does not have user consent.

When used in a VAST tag and the third-party provider lacks user consent, this macro will not expand.

The ${GDPR_CONSENT_XXXX} macro should only occur once within the URL. Contact your third-party creative vendor to understand their requirements on passing the TC string and URL length restrictions. The macro will be replaced on relevant IAB TCF v2.0 requests with the full, unmodified TC string.

Transparency and Consent Framework (TCF) macros do not expand when they are implemented in the HTML of an HTML5 creative. Only Display Redirect and Custom Display creatives support expanding TCF macros via “Third-party URL” and “HTML code” fields respectively.

Additional Consent Mode
 
Macro
${ADDTL_CONSENT}
 

Expands to the Additional Consent (AC) string associated with the request.

EEA and UK users under the age of consent
 
Macro
%%TFUA%%
 

Expands to value of 1 to tag the request for EEA and UK users under the age of consent.

Video macros

These macros are commonly used in video creatives to include details about the context or content.

Video ad duration, in milliseconds
 
Macro
%%VIDEO_AD_DURATION%%
 

Expands to the duration of the video ad in milliseconds. For VAST wrappers/redirects, the macro expands to the declared duration of the ad in Ad Manager.

Video description URL
 
Macro Escaping
%%DESCRIPTION_URL_UNESC%% Unescaped
%%DESCRIPTION_URL_ESC%% Escaped
%%DESCRIPTION_URL_ESC_ESC%% Double-escaped
 

Use %%DESCRIPTION_URL_ESC%% (single-escaped) when the macro is inside a URL, and use %%DESCRIPTION_URL_UNESC%% (unescaped) in other contexts. Learn more about escaped vs. unescaped macros

In redirect ad tags, these macros expand to the description URL parameter from the original Google Publisher Tag's description_url query parameter. The description URL should typically be the same as the referrer URL. You should specify the description_url in the Google Publisher Tag if there are embeds where the IMA SDK might not accurately detect the page URL, or if you are using video in Ad Exchange or AdSense for Video.

Ad Manager also supports %%DESCRIPTION_URL%%, which does the same thing as %%DESCRIPTION_URL_UNESC%%, so there's no need to recode older creatives and templates.
Video referrer URL
 
Macro Escaping
%%REFERRER_URL_UNESC%% Unescaped
%%REFERRER_URL_ESC%% Single-escaped
%%REFERRER_URL_ESC_ESC%% Double-escaped
 

Use %%REFERRER_URL_ESC%% (single-escaped) when the macro is inside a URL, and use %%REFERRER_URL_UNESC%% (unescaped) in other contexts. Learn more about escaped versus unescaped URL macros

This macro expands to the referrer URL (the URL of the page where the video player is located) in redirect ad tags. It does so in the following manner: Ad Manager parses the ad tag's URL query parameter, isolates the referrer URL, and replaces the macro text with that URL. It works only with the Google IMA SDK, with the following qualifications:

  • Script access must be activated on the page for this macro to work.
  • The macro doesn't work inside an iframe.
Ad Manager also supports %%REFERRER_URL%%, which does the same thing as %%REFERRER_URL_UNESC%%, so there's no need to recode older creatives and templates.
 
You can use the tag parameter macro in conjunction with some video parameters to expand to the value of those parameters.

Video content macros

These macros are used for ads that target video content sources.

Only available in Google Ad Manager 360.
Video duration, in milliseconds
 
Macro
%%VIDEO_DURATION%%
 

Expands to the duration of the video in milliseconds.

Video ID
 
Macro
%%VIDEO_ID%%
 

Expands to the ID of the video content currently playing, which is the unique ID in the CMS or the dfpvideo:ContentID value from MRSS. 

Video metadata
 
Macro
%%VIDEO_METADATA:key%%
 

Expands to metadata about the video where the creative is being served, based on key-values associated with the video content. The key-values are set up in Ad Manager in the "Video" tab. 

Once a video metadata key has been targeted, it can be expanded by the video metadata macro. The "key" used in the macro must be alphanumeric characters or the underscore (_).

Video title
 
Macro Escaping
%%VIDEO_TITLE%% Single-escaped
 

The video title macro expands to display the title of a video as defined in Ad Manager.

Content ingestion is required for this macro to work. 

Only available in Google Ad Manager 360.
Custom ad ID (FreeWheel)
 
Macro
%%FW_CAID%%
 

Expands to the FreeWheel custom ad ID.

This macro only applies to publishers using FreeWheel for video ad serving.

IAB categories (FreeWheel)
 
Macro
%%IAB_CATEGORIES%%
 

Used to pass ad categories for creatives that you've manually classified with labels. This macro returns a comma-separated list of applicable standard IAB categories (converted from Google classified categories).

This macro can be used by publishers sharing video inventory with FreeWheel, and want to pass ad categories as custom parameters. For example, you could add &iab_categories=%%IAB_CATEGORIES%% to your VAST redirect tag.

Was this helpful?

How can we improve it?
true
Release notes

Read about the latest Ad Manager features and Help Center updates.

See what's new

Search
Clear search
Close search
Google apps
Main menu
6915759017533143680
true
Search Help Center
true
true
true
true
true
148
false
false