As part of continual improvements to our infrastructure, we've updated the content delivery network that serves our JavaScript SDK to your users.

The update improves performance for you users: it reduces the size of the downloaded SDK by up to 50% and improves network latency.

Replacing your existing Permutive JavaScript snippet

To update your Permutive JS tag, you will need to replace the existing tag with the following updated tag.

<script>!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 t=Array.prototype.slice.call(arguments,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://")+"cdn.permutive.com";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>",{});</script>

Please note <PROJECT_ID>  and <API_KEY> must be replaced with your Permutive project's ID and a public API key, respectively.

  • <PROJECT_ID>: This is the 36-character string passed as the first argument to permutive.init  in your existing snippet. You can also find this under Project ID in the Settings section for your project in our dashboard.
  • <API_KEY> : This is the 36-character string passed as the second argument to permutive.init  in your existing snippet. You can also find this value by choosing one of your public keys in the SettingsKeys section for your project in our dashboard.

Many of our customers insert their own page properties into the Permutive tag. This is where the following code appears at the end of the script:

permutive.addon("web", {page: {
  // Page properties here
}});

If your tag includes page properties, your code for this should remain unchanged - you should keep this code at the end of the new tag.

You will need to update your tag on every site/domain where Permutive is deployed.

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?