On some platforms it may not be possible to show video ads if they place you inside an iframe so your ads track to the platform domain but they don’t provide you with access to their ads.txt file. For these situations we provide the z2 window option that allows you to track ads to your own domain rather than the platform domain so you can manage your own ads.txt file to enable high-CPM video ads.
The z2 window must be launched from a click event or it will fail. There are many different ways to do this such as using the initial “Play” button, the “X” button from a purchase dialog or a specific button to watch reward videos. The normal ad windows will run without a click event but if you are stuck in a situation where your ads are tracking to the iframe owner and you cannot access the ads.txt file, then you will only be able to show banners and rich media ads using the fallback option unless you use a z2 window.
There are a number of z2 support items found in the download bundle obtained using the download link on the Games page of the Applixir Website. These bundles are customized per game type so make sure to use the link after the specific game you are working on. You will need the file named “Applixir-snippets<date>.txt” (e.g. Applixir-snippets111718a.txt) and “z2index.html”.
To enable z2 windows first add the z2index.html file from the download bundle to the directory your game runs in. It will run as-is but you can replace the “*” values in postMessage() as described below. Next add your z2 option values using the z2 section of the snippet file from the download bundle. Use the same options as your current integration without the callback function which is handled automatically.
Make sure to place an ads.txt file in the root directory of your game domain. Contact Applixir for the required ads.txt entries or a copy of an ads.txt file if you do not already have one since you will not receive videos from the ad networks without this.
Once the z2index.html file is installed and you’ve added the the z2 options and listener snippet, place a new entry in your existing options as follows and you will be done:
z2 Snippet functionality overview
In order to exchange data and callbacks between your integration and the z2 window, the z2 snippet and z2index.html work together to pass the option values to the z2window and return the local callback events to your integration code. This allows you to configure all options for the z2 window within your integration to simplify setup, especially the use of dynamic values in custom1 and custom2. Please do not modify the snippet code except for the option values.
When the z2 window opens it creates a listener then sends a z2-ready message to tell the integration side that it’s open and ready to load the options. The integration receives the z2-ready message then packages the options with JSON and sends them to the z2 window which parses the JSON and places the options into the object that will be used by invokeApplixerVideoUnit. Once done the listener removes itself. As the video is displayed, events arrive at the callback and are relayed back to the integration by the postMessage call.