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.

!function(e,n,t,r,o,i){if(!n){n=n||{},window.permutive=n,n.q=[],n.config=i||{},n.config.projectId=r,n.config.apiKey=o,n.config.environment=n.config.environment||"production";for(var c=["addon","identify","track","trigger","query","segment","segments","ready","on","once","user"],a=0;a<c.length;a++){var s=c[a];n[s]=function(e){return function(){var,0);n.q.push({functionName:e,arguments:t})}}(s)}var p=window.Worker?"async":"blocking",g=e.createElement("script");g.type="text/javascript",g.async=!0;var m=("https:"==e.location.protocol?"https://":"http://")+"";g.src=m+"/"+r+"-"+p+".js";var u=e.getElementsByTagName(t)[0];u.parentNode.insertBefore(g,u)}}(document,window.permutive,"script","<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>"]

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.

Many of our customers use Permutive's DoubleClick For Publishers integration. If you intend to use our 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() .

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

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 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?