...
Include the following <script> tag, preferably within the web page <head> tag:
<script async src="vpt.min.js"></script>
Initialize the following configuration object to the windowobject:
Code Block language js window.verityConfig = { apiKey: ‘<API Key supplied by GumGum>’, zoneId: ‘<Zone Id supplied by GumGum>’ }
Note: The page URL is extracted byvpt.min.js
usingwindow.location.href
.Optionally, callback functions may be passed to Verity to execute once Verity API returns a response.
Note: The response may be for a page classification with any status, so the callback should handle each possible status message. See Page Application Status Codes for details about status messages that Verity may return.Code Block language js window.verity.cmd.push(function(data, error) { // do something }); }
Callback functions can be implemented to use the Verity result data. For example, a callback could publish targeting keywords using Verity data, then fetch new ads using the Google Publisher Tag
googletag.pubads().refresh()
. For example:Code Block language js window.verity.cmd.push(function(data, error) { console.log(‘Verity done’, window.verity.getKeywords(), data, error); google tag.cmd.push(function() { googletag.pubads().setTargeting(‘keywords’, window.verity.getKeywords().concat([‘VERITY’])); googletag.pubads().refresh(); }); }
...