Subresource Integrity - SRI Hash
Like the Content Security Policy (CSP), SRI (Subresource Integrity) is a security feature that lets browsers check that the files they fetch (for example, from a CDN) are delivered without unexpected tampering. It works by letting you supply a cryptographic hash that the fetched file must match.
To let Eulerian work under SRI, you need to use a fixed version of the Eulerian JavaScript. Our servers let you pin the version you will work with.
Sample SRI implementation template
<script>
let EA_vers = '<EA_VERSION>';
let EA_sri = '<EA_SRI_SHA_STRING>';
(function(e,a){var i=e.length,y=5381,k='script',s=window,v=document,o=v.createElement(k);for(;i;){i-=1;y=(y*33)^e.charCodeAt(i)}y='_EA_'+(y>>>=0);(function(e,a,s,y){s[a]=s[a]||function(){(s[y]=s[y]||[]).push(arguments);s[y].eah=e;};}(e,a,s,y));i=new Date/1E7|0;o.ea=y;y=i%26;
o.async=1;o.crossOrigin='anonymous';o.integrity=EA_sri;e+='/fv/'+EA_vers;
o.src='//'+e+'/'+String.fromCharCode(97+y,122-y,65+y)+(i%1E3)+'.js?2';s=v.getElementsByTagName(k)[0];s.parentNode.insertBefore(o,s);})
('mon.domainedetracking.com','EA_push');
</script>
It contains two “static” parameters that you will need to replace.
The JavaScript version, <EA_VERSION>
This is the version of the main ea.js. To find the version you want to use, go to the following address, replacing the domain with yours:
mon.domainedetracking.com/fv/vers.txt
You get a list of the available versions. Pick one, preferably the highest: this is your <EA_VERSION> variable to replace.
The hash, <EA_SRI_SHA_STRING>
This is the hash result prefixed by its type (sha256, sha384 or sha512) and a hyphen. Choose one of the available hashes, which we will call <HASH> here, then go to this address:
mon.domainedetracking.com/fv/<EA_VERSION>/ea.<HASH>.txt?2
For our site www.eulerian.com, with the tracking domain mj23.eulerian.com and a sha256, this gives:
https://mj23.eulerian.com/fv/5.5.1/ea.sha256.txt?2
You get the current hash of that JavaScript version, in our example uuQ2A5JrShq7Hbj6PlnRdnpJ/N4mU9RkLHJEy8kp7Lo=. Once prefixed with <HASH>-, this is your <EA_SRI_SHA_STRING> variable to replace, here sha256-uuQ2A5JrShq7Hbj6PlnRdnpJ/N4mU9RkLHJEy8kp7Lo=.
Implementation example
Important
Do not copy and paste this example: adapt it to your own SRI.
<script>
let EA_vers = '5.5.1';
let EA_sri = 'sha256-hkhVx+B05oiOChsViCasVOlEaE18JlE3aBxTzJEvUXo=';
(function(e,a){var i=e.length,y=5381,k='script',s=window,v=document,o=v.createElement(k);for(;i;){i-=1;y=(y*33)^e.charCodeAt(i)}y='_EA_'+(y>>>=0);(function(e,a,s,y){s[a]=s[a]||function(){(s[y]=s[y]||[]).push(arguments);s[y].eah=e;};}(e,a,s,y));i=new Date/1E7|0;o.ea=y;y=i%26;
o.async=1;o.crossOrigin='anonymous';o.integrity=EA_sri;e+='/fv/'+EA_vers;
o.src='//'+e+'/'+String.fromCharCode(97+y,122-y,65+y)+(i%1E3)+'.js?2';s=v.getElementsByTagName(k)[0];s.parentNode.insertBefore(o,s);})
('mj23.eulerian.com','EA_push');
</script>