# Install the JENTIS Web Tag

Integrating a JavaScript code snippet is necessary to begin collecting data with JENTIS on your website.

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 data stream.

{% hint style="info" %}
Inserting the tracking code snippet directly on your website and not via third-party tools is essential.
{% endhint %}

{% hint style="warning" %}
**Please do not copy/paste the following snippet or parts of it. The following code is just a visual example.**\
You will find your code in your JENTIS account (homepage).
{% endhint %}

{% code lineNumbers="true" %}

```js
// 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>");
```

{% endcode %}

{% hint style="warning" %}
You will find your exact JavaScript snippet by creating a new container or editing an existing one
{% endhint %}

<figure><img src="https://2315305008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy15ncufYr341K5U8q6Of%2Fuploads%2F0n6n5vsVQxkV6nHM0iLq%2Fimage.png?alt=media&#x26;token=4db41915-6ee3-4718-9952-7794e25a4d9d" alt=""><figcaption></figcaption></figure>

<table><thead><tr><th width="144.5">Placeholder</th><th width="316.59375">Description</th><th width="82.08984375">Type</th><th>Example</th></tr></thead><tbody><tr><td>&#x3C;trackdomain></td><td>Your JENTIS container DNS Domain. This will be replaced in your individual JTM container automatically when the code is generated in the UI.</td><td>string</td><td>https://hhd728ju.example.org</td></tr><tr><td>&#x3C;trackid></td><td>Your JENTIS container Identifier. This will be replaced in your individual JTM container automatically when the code is generated in the UI.</td><td>string</td><td>example-id</td></tr><tr><td>&#x3C;environment></td><td>Replace the placeholder with a string defined for your environment. The following setup should be used as a default:<br><code>live</code> for the domain including the productive systems (default with your JTM container when created)<br><code>stage</code> on the staging and/or quality control systems</td><td>string</td><td>live</td></tr><tr><td>&#x3C;version></td><td><p>By default the code will fallback to the latest version, indicated by a <code>_</code> value.</p><p>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:<code>_</code>for loading the last published version of the JENTIS Tag Manager container.</p></td><td>string</td><td>_</td></tr><tr><td>&#x3C;filehash></td><td>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.</td><td>string</td><td>hj8kds</td></tr></tbody></table>

## Testing <a href="#jentiscodesnippet-testing" id="jentiscodesnippet-testing"></a>

If you have correctly set up the JENTIS tracking code snippet, you can find a network log entry (HTTP stream) in your browser's developer tools.

The resource loaded looks like the following:

```none
https://<hash>.example.at/get/live/web/_/<filehash>.js
```

To ensure the JENTIS script is loaded correctly, the DNS A record must be set. For more information, read the article [DNS Setup](https://docs.jentis.com/getting-started/quickstart/make-tracking-first-party-set-your-dns).

After these steps, the script will load and respond with a 200 status code. A secure connection can now be established, and your JavaScript is available.

Your configuration will also be automatically verified within up to 30 minutes after you set up the JENTIS tracking code snippet on your website. Alternatively, you can return to your container’s configuration and click **Verify**.

You can always check the status of your HTML Code on your containers' configuration:

<figure><img src="https://2315305008-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fy15ncufYr341K5U8q6Of%2Fuploads%2F1vycV0ZxN1uqIktLMwFo%2Fimage.png?alt=media&#x26;token=bb8f0e35-13f3-4316-bcc0-8743272cb78f" alt=""><figcaption></figcaption></figure>

## Start Tracking <a href="#jentiscodesnippet-starttracking" id="jentiscodesnippet-starttracking"></a>

### Implementing Pageview Tracking with JENTIS

To start tracking with JENTIS, use the following JavaScript function calls. These commands enable automatic tracking whenever a page is visited.

Add the following lines of code to your web application:

```javascript
_jts.push({track: "pageview"});
_jts.push({track: "submit"});
```

## **Alternative Method**

Alternatively, under the [Codes](https://docs.jentis.com/jentis-dcp-elements/codes) section, insert the code snippet as a custom element within your JENTIS account. This ensures that a pageview is tracked each time the basic JENTIS tracking code snippet is executed.

***

If you have any questions or suggestions, contact us through our [Helpdesk](https://jentis.atlassian.net/servicedesk/customer/portal/1).
