Macros

MoPub supports the following macros:

Type Macro
Account ID (Publisher ID) %%ACCOUNT_KEY%%
Ad Group ID (Line Item ID) %%ADGROUPID%%
Advertising ID %%ADVERTISING_ID%%
Advertising ID (IFA) %%ADVERTISING_ID_IFA%%
Advertising ID (IFV) %%ADVERTISING_ID_IFV%%
Ad Unit Format (Escaped) %%ADUNIT_FORMAT_ESC%%
Ad Unit ID %%ADUNITID%%
Ad Unit Name (Escaped) %%ADUNIT_NAME_ESC%%
App Name (Escaped) %%APPNAME_ESC%%
Bundle ID %%BUNDLE%%
Cache Buster %%CACHEBUSTER%%
Click URL (Escaped) %%CLICK_URL_ESC%%
Click URL (Unescaped) %%CLICK_URL_UNESC%%
Creative ID %%CREATIVEID%%
Creative Type (Escaped) %%CREATIVE_TYPE_ESC%%
Destination URL (Double Escaped) %%DEST_URL_ESC_ESC%%
Destination URL (Escaped) %%DEST_URL_ESC%%
Do Not Track %%DNT%%
IP Address %%IPADDRESS%%
Keywords %%KEYWORDS%%
Keywords (specific key) %%KEYWORD:[key]%%
Latitude %%LATITUDE%%
Longitude %%LONGITUDE%%
Placement ID (App ID) %%PLACEMENTID%%
Request ID %%REQUESTID%%
Size (Creative wxh) %%SIZE%%
User Agent (Escaped) %%USERAGENT%%

Notes about Macros

  • If you’re passing over key value pairs, you can set a macro to return the value for a particular key using the %%KEYWORD:[key]%% macro. Example: If you’re passing over “gender:male,age:24” as your keywords, you can use the %%KEYWORD:age%% macro to pass the age into your ad. %%KEYWORD:age%% will be replaced with 24
  • Cachebusters are noted by &ord= parameters.
  • If your HTML ad is using an anchor tag (<a href>) or window.location redirect, our SDK automatically tracks clicks.
  • The %%CACHEBUSTER%% macro returns UNIX timestamp in milliseconds.
  • Advertising IDs for %%ADVERTISING_ID%% can be one of the following: IDFA, Android Advertising ID (if Google Play Services is integrated) or Amazon Advertising ID
  • The %%DNT%% macro returns 0 for no opt out or 1 for opt out (do-not-track).
  • The %%PLACEMENT%% returns an App ID for in-app.
  • The Request ID is a unique ID assigned to each ad request.

MoPub also supports substitution macros, as defined by the OpenRTB specifications. See here in our spec for full list of substitution macros.

Legacy Macros

The following legacy macros still work but please prioritize updating to the new versions. We made this change to normalize the format and naming of macros.

  • %%ADGROUPID%% is the new macro for %eaid!
  • %%ADVERTISING_ID%% is the new macro for %eudid!
  • %%CREATIVEID%% is the new macro for %ecid!

Last updated November 18, 2020

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2020 MoPub (a division of Twitter, Inc.)