JENTIS Code Snippet
JENTIS Tracking Code Snippet
In order to begin collecting data with JENTIS on your website, it is necessary to integrate a JavaScript code snippet.
We suggest inserting this code snippet as high as possible within the HTML head section of your website. This will create the optimal conditions for a stable and reliable stream of data.
It is essential to insert the tracking code snippet directly on your website and not via third-party tools.
Do not Copy Paste
The following code is just a visual example. Do not copy-paste the code or parts of it.
You will find your individual code in your JENTIS account (homepage).
JavaScript
// DO NOT COPY - JUST FOR VISUAL REFERENCE
(function (sCDN, sCDNProject, sCDNWorkspace, sCDNVers) {
if (
window.localStorage !== null &&
typeof window.localStorage === "object" &&
typeof window.localStorage.getItem === "function" &&
window.sessionStorage !== null &&
typeof window.sessionStorage === "object" &&
typeof window.sessionStorage.getItem === "function"
) {
sCDNVers =
window.sessionStorage.getItem("jts_preview_version") ||
window.localStorage.getItem("jts_preview_version") ||
sCDNVers;
}
window.jentis = window.jentis || {};
window.jentis.config = window.jentis.config || {};
window.jentis.config.frontend = window.jentis.config.frontend || {};
window.jentis.config.frontend.cdnhost =
sCDN + "/get/" + sCDNWorkspace + "/web/" + sCDNVers + "/";
window.jentis.config.frontend.vers = sCDNVers;
window.jentis.config.frontend.env = sCDNWorkspace;
window.jentis.config.frontend.project = sCDNProject;
window._jts = window._jts || [];
var f = document.getElementsByTagName("script")[0];
var j = document.createElement("script");
j.async = true;
j.src = window.jentis.config.frontend.cdnhost + "<filehash>.js";
f.parentNode.insertBefore(j, f);
})("<trackdomain>","<trackid>","<environment>", "<version>");
Placeholder
Placeholder | Description | Type | Example |
---|---|---|---|
<trackdomain> | Your JENTIS container DNS Domain. This will be replaced in your individual JTM container automatically when the code is generated in the UI. | string | |
<trackid> | Your JENTIS container Identifier. This will be replaced in your individual JTM container automatically when the code is generated in the UI. | string | example-id |
<environment> | Replace the placeholder with a string defined for your environment. The following setup should be used as a default: | string | live |
<version> | By default the code will fallback to the latest version, indicated by a Optionally replace the placeholder with a string which defines the version you want to load to your setup, if no dynamic update is desired. The following setup will be used as a default: | string | _ |
<filehash> | A unique identifier for a container source file. This will be replaced in your individual JTM container automatically when the code is generated in the UI. | string | hj8kds |
Testing
If you have correctly set up the JENTIS tracking code snippet, you will be able to find a network log entry (HTTP stream) in your browser's developer tools.
The resource loaded looks like the following:
https://<hash>.example.at/get/live/web/_/<filehash>.js
To make sure, the JENTIS script is loaded correctly, the DNS A Record has to be set. You can check our documentation on DNS Setup here.
After these steps, the loading of the script will respond with a 200 status code. Now a secure connection can be established and your Javascript is available.
Start Tracking
To implement the very first call and therefore tell JENTIS what to do you might use the following call. This will instruct JENTIS to track a pageview, which is the most common first step to start tracking.
JavaScript
_jts.push({track:"pageview"});
_jts.push({track:"submit"});
This call can be implemented in your web application and thus activate tracking whenever a page is navigated.
A different idea might be to use this two lines of code and add it in your JENTIS account as a custom element in the Codes section. So JENTIS will automatically track a pageview every time the JENTIS basic tracking code snippet is loaded up.
Next Steps
Now that we have JENTIS up and running on your website - how about the tracking map? Do you have already a clear plan on further implementation to meet certain goals?
Let's look into the Architecture Guideline - Push OR Pull for the options we have to meet all those objectives on tracking.