Integrating your site with Permutive is simple. We'll provide you with a JavaScript tag to include on your pages, and will work with you to configure the tag to pick up details about your content. Finally, we'll work with you to verify a successful deployment.

Deploying the Tag

Our team will provide you with the latest version of the Permutive JavaScript tag. The tag will look similar to the below example, but will be configured for deployment on your site.

<script>
!function(n,e,o,r,i){if(!e){e=e||{},window.permutive=e,e.q=[],e.config=i||{},e.config.projectId=o,e.config.apiKey=r,e.config.environment=e.config.environment||"production";for(var t=["addon","identify","track","trigger","query","segment","segments","ready","on","once","user","consent"],c=0;c<t.length;c++){var f=t[c];e[f]=function(n){return function(){var o=Array.prototype.slice.call(arguments,0);e.q.push({functionName:n,arguments:o})}}(f)}}}(document,window.permutive,"<PROJECT_ID>","<API_KEY>",{});
permutive.addon("web", { page: {
  article: {
    id:          "<ARTICLE_ID>",
    title:       "<ARTICLE_TITLE>",
    description: "<ARTICLE_DESCRIPTION>",
    url:         "<ARTICLE_URL>",
    section:     "<ARTICLE_SECTION>",
    categories:  ["<CATEGORY1>","<CATEGORY2>"]
}}});
</script>
<script async src="https://cdn.permutive.com/<PROJECT_ID>-web.js"></script>


When deploying the script, ensure it is placed in between your pages' <head> and </head> tags. We recommend our customers deploy Permutive early on the page, i.e. above other scripts in the <head> section where possible. This helps ensure Permutive loads as quickly as possible and updates targeting information on the page before ad calls are made. 

We recommend against deploying our tag via tag managers, such as GTM, as doing this can cause significant delays and prevent Permutive from loading quickly. Note that our script loads asynchronously, so should not have a negative effect on page load.

DFP / Google Ad Manager

Many of our customers use Permutive's DoubleClick For Publishers integration. If you intend to use the DFP integration in future, an additional deployment step is needed at this stage. 

We recommend all customers deploy a small piece of JavaScript which reads Permutive targeting data from the browser cache, and ensures it is passed into DFP early on page load. By doing this, we can guarantee that cached Permutive segments are sent into DFP on every ad request.

The JavaScript required for this is shown below. This script should be placed after googletag  is defined but before a call is made to googletag.enableServices() .

<script>
googletag.cmd.push(function() {
  var kvs = localStorage.getItem('_pdfps');
  googletag.pubads().setTargeting('permutive', kvs ? JSON.parse(kvs) : []);
});
</script>

Testing and Verification

We recommend you first deploy Permutive on a test site or test page, where possible. Once this is done, drop an email to techsupport@permutive.com with a link to your test page, and someone from our team will double check the deployment.

The basic things our team will check for are:

  1. The script is deployed in the correct position on the page.
  2. Custom properties are being sent into Permutive in the correct format.
  3. Permutive API servers are receiving and processing data.
  4. Preparation for DFP integration is complete.

This article assumes that you already have a Permutive project and have been provided our JavaScript tag for deployment on site. If this is not the case, then please get in touch!

Did this answer your question?