Setup

How to get the web tracking snippet and web tracking API key.

Getting the web tracking snippet

To set up web tracking, first you need to get the tracking snippet from your CrossEngage account system setup area.

You can also use the snippet below, replacing the placeholder with your web tracking API key, which can also be found in the system setup area.

Webtracking snippet
window.xngID = "Your webtracking API key";
!(function(e, n, t) {
function r(e) {
return function() {
return t.push(Array.prototype.concat.apply([e], arguments)), t;
};
}
function i() {
var e = document.createElement(n),
t = document.getElementsByTagName(n)[0];
(e.async = !0),
(e.src = "https://app.crossengage.io/analytics.min.js"),
t.parentNode.insertBefore(e, t);
}
var o, a = ["trackSubmit", "trackClick", "trackLink", "trackForm",
"pageview", "identify", "group", "track", "ready", "alias", "page",
"once", "off", "on"];
if (((t = e.analytics = e.analytics || []), !t.initialize))
if (t.invoked)
e.console &&
console.error &&
console.error("CrossEngage snippet included twice.");
else {
for (t.invoked = !0; (o = a.shift()); ) t[o] = r(o);
i();
}
})(window, "script");

Installing the snippet

To install the snippet, follow the below steps:

Using a tag manager
Without a tag manager
Using a tag manager
  1. Copy the snippet.

  2. Create a tag that contains Custom HTML

  3. Once created, paste the snippet and wrap it between <script></script>.

  4. Ensure that you create or select a trigger, one that listens for a successful page load, for your newly created snippet. For single page applications, you will only need to trigger the tag once, however, for multi page applications, you should trigger the tag on every successful page load.

Without a tag manager
  1. Copy the snippet.

  2. Paste it in the <head> section of your website, wrapped in <script></script>.