MoPub Mobile App Integration via VAST
Last updated on July 30, 2020
If you are using the OpenX Ad Exchange and MoPub as your ad server, you can create OpenX VAST ad tags to integrate with MoPub and pass various parameters from custom apps on Android and iOS devices.
The tag you generate by creating a mobile app linear video ad unit in the OpenX user interface (UI) comes with some MoPub macros already appended.
You can include additional MoPub macros in OpenX ad tags to automatically capture other user-specific parameters. However, if you want to define additional inventory-specific parameters, you must do so manually with URL-encoded values.
openrtb parameter in the sample code below for an example of URL-encoded values.
Sample VAST Ad Tag with MoPub Macros
The following VAST XML tag is an example of what you generate by creating a mobile app linear video ad unit in the OpenX UI and choose MoPub as your ad server:
<?xml version="1.0" encoding="UTF-8"?> <VAST version="2.0"> <Ad id="0123456789"> <Wrapper> <AdSystem version="1.0">OpenX Enterprise</AdSystem> <VASTAdTagURI> <![CDATA[http://your-instance.openx.net/v/1.0/av?auid=0123456789&ifa=%eudid!&lmt=%%DNT%%&app.bundle=%%BUNDLE%%&ip=%%IPADDRESS%%&lat=%%LATITUDE%%&lon=%%LONGITUDE%%&dr=true&cb=%%CACHEBUSTER%%&ua=%%USERAGENT%%&openrtb=%7B%22publisher%22%3A%7B%22name%22%3A%22Publisher1%22%7D%7D]]> </VASTAdTagURI> </Wrapper> </Ad> </VAST>
The table below summarizes the MoPub macros that OpenX pairs with those parameters.
|Parameter||Macro||This macro dynamically inserts…|
|The IDFA, SHA1 Hashed Android ID, or Android Advertising ID (if Google Play Services is integrated) from the users’ device.|
|The setting from the user’s device that indicates if private browsing is enabled (if the user has requested not to be tracked).|
|The app’s Bundle ID.|
|The IP address from the user’s device.|
|Latitude data from the user’s device.|
|Longitude data from the user’s device.|
|The UNIX time stamp in milliseconds as a random number to avoid browser caching.|
|The device user agent, which typically indicates the app or browser making the request.|
- Paste your new tag into the VAST XML field of the MoPub UI as explained in MoPub’s documentation.
- Set up OpenX selling rules.