MoPub supports the following macros:

Type Macro Notes
Line Item ID (aka Ad Group ID) %%ADGROUPID%% %eaid! will still work but the recommendation is to use %%ADGROUPID%%
Ad Unit ID %%ADUNITID%%  
Ad Unit Format %%ADUNIT_FORMAT_ESC%%  
Bundle ID %%BUNDLE%%  
Cache Buster %%CACHEBUSTER%%  
Click URL (Escaped) %%CLICK_URL_ESC%%  
Click URL (Unescaped) %%CLICK_URL_UNESC%%  
Creative ID %%CREATIVEID%% %ecid! will still work but the recommendation is to use %%CREATIVEID%%
Creative Type %%CREATIVE_TYPE_ESC%%  
Destination URL (Double Escaped) %%DEST_URL_ESC_ESC%%  
Destination URL (Escaped) %%DEST_URL_ESC%%  
Destination URL (Unescaped) %%DEST_URL%%  
Device ID %eudid!  
Do Not Track %%DNT%%  
IP Address %%IPADDRESS%%  
Keywords %%KEYWORDS%%  
Keywords (specific key) %%KEYWORD:[key]%%  
Latitude %%LATITUDE%%  
Longitude %%LONGITUDE%%  
Placement ID (App ID / Site ID) %%PLACEMENTID%%  
Request ID %%REQUESTID%%  
User Agent %%USERAGENT%%  

Notes about Macros

  • %eaid! will still work for Line Item ID (aka Ad Group ID) but the recommendation is to use %%ADGROUPID%%.
  • 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.
  • Device IDs can be one of the following: IDFA, Android Advertising ID (if Google Play Services is integrated) or SHA1 Hashed Android 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.

Last updated August 24, 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.)