CDN

Front-end integration with our CDN

The script can be injected via your TMS (Tag Management System), or simply embedded on your website. Once you do, you will have the SDK available.

Even if the library is called xo it's used for both FHR & XO

<script type="text/javascript">
!function(att,raq,t){
    var version = "2";
    var supportOldBrowsers = false;
    att[raq]=att[raq]||[];var n=["init","send","setUser","addUserIdentity","setUserIdentities","addUserSegment","setUserSegments","addUserTrait","setUserTraits","clearUser","getUserClusters"];if(!att.xo){att.xo={activity:{},init:function(e){att[raq].push(["init",e.activity])}};for(var r=0;r<n.length;r++)att.xo.activity[n[r]]=function(e){return function(r,s,a){att[raq].push([n[e],r,s,a])}}(r)}var s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src=t+version+".min.js",(att.document.documentMode||supportOldBrowsers)&&(s.src=t+version+".compat.min.js");var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(s,a);
}(window,"_attraqt","https://cdn.attraqt.io/xo.all-");
</script>

You should inject this snippet as early as possible - preferably in the header. We have purposely kept the client lightweight so that it does not slow down your page.

To ensure we don't miss any event, you can start sending events even before the client is fully loaded, thanks to our built-in queuing system.

CDN advanced options

The client is designed to works on all recent browsers. If you require support for legacy browsers, please set the "supportOldBrowsers" option to "true".

<script type="text/javascript">
!function(att,raq,t){
    var version = "2";
    var supportOldBrowsers = true;
    att[raq]=att[raq]||[];var n=["init","send","setUser","addUserIdentity","setUserIdentities","addUserSegment","setUserSegments","addUserTrait","setUserTraits","clearUser","getUserClusters"];if(!att.xo){att.xo={activity:{},init:function(e){att[raq].push(["init",e.activity])}};for(var r=0;r<n.length;r++)att.xo.activity[n[r]]=function(e){return function(r,s,a){att[raq].push([n[e],r,s,a])}}(r)}var s=document.createElement("script");s.type="text/javascript",s.async=!0,s.src=t+version+".min.js",(att.document.documentMode||supportOldBrowsers)&&(s.src=t+version+".compat.min.js");var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(s,a);
}(window,"_attraqt","https://cdn.attraqt.io/xo.all-");
</script>

This option loads a polyfilled version of our library, which increases its weight.

The version can either be a major version, which will allow you to benefit from all the backward compatible updates automatically, or an exact one (x.x.x). You can find a list of all available version here.

Initializing the library

Once the snippet is added, you need to initialize the library so you can use it. Check the following link.

pageInitializing the JavaScript Library

Last updated