Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Include the following <script> tag, preferably within the web page <head> tag:
    <script async src="vpt.min.js"></script>

  2. Initialize the following configuration object to the windowobject:

    Code Block
    languagejs
    window.verityConfig = {
     apiKey: ‘<API Key supplied by GumGum>’,
     zoneId: ‘<Zone Id supplied by GumGum>’
     }


    Note: The page URL is extracted by vpt.min.js using window.location.href.

  3. 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
    languagejs
    window.verity.cmd.push(function(data, error) {
       // do something
       });
    }

  4. 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
    languagejs
    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();
       });
    }

...