# Setup

To set up web tracking on your website, first you need to copy the Web Tracking code snippet from the CrossEngage app.

* Go to Settings -> System Setup.
* Click on Web Tracking, and copy the code snippet.

<figure><img src="/files/ts2heJITjL25OKODsgkj" alt=""><figcaption></figcaption></figure>

You can also copy the code below; Please make sure to add your Web-Tracking Key in the first line of the code.

{% code overflow="wrap" %}

```javascript
window.xngID = "your-tracking-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");
```

{% endcode %}

#### Installing the Code Snippet

{% tabs %}
{% tab title="Using a Tag Manager" %}

* Create a tag that contains *Custom HTML*
* Once created, paste the snippet and wrap it between `<script></script>`.
* 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**.&#x20;
  {% endtab %}

{% tab title="Without a Tag Manager" %}
Paste the code snippet to the \<head> of your website, wrapped in \<script>...\</script>.
{% endtab %}
{% endtabs %}

####


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.crossengage.io/data-and-engagement-platform/web-tracking/web-tracking-v1-legacy/setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
