# End-to-end analytics

## <mark style="color:orange;">To set up end-to-end analytics, contact your website administrator.</mark>

### Instructions for installing the code for end-to-end analytics

This guide will help you set up the collection of end-to-end analytics tags using WABA, WhatsApp and Telegram bots and Telegram Personal in Kommo.

### What data is being collected

1. Referrer
2. Google Analytics
3. UTM parameters

**Step 1**: Setting up Trackers:

1. **Copy the tracker code:**

```javascript
<script>
    !function(r,t,e,s,a,n,c){r[a]=r[a]||function(){(r[a].a=r[a].a||[]).push(arguments)},r[a].l=1
    *new Date;for(var i=0;i<document.scripts.length;i++)if(document.scripts[i].src===s)return
    ;n=t.createElement(e),c=t.getElementsByTagName(e)[0],n.async=1,n.src=s,c.parentNode
    .insertBefore(n,c)}(window,document,"script","https://track.radist.me/tracker.min.js","radist_tracker");

radist_tracker({
      message: "Здравствуйте! Появились вопросы по вашему продукту. Номер заявки: {radist_tracker}" ,
      whatsapp_enabled: true,
      tgbot_enabled: true,
      tg_enabled: true
});
</script>
```

2. **Set up trackers:**

In the file, find the following line:

```javascript
message: "Hello! I have a question about your product. Track number: {radist_tracker}",
```

**Replace the text of the message with the one you need. This text will be inserted into WhatsApp links.**

**Important**: the `{radist_tracker}` label must remain at the end of the message. Our session tracking number will be substituted in its place.

**Example**: If you want to change the message to "Good afternoon! I have a question", substitute the following text:

```javascript
message: "Good afternoon! I have a question {radist_tracker}",
```

**If you do not want the tracker to replace links to WhatsApp**, find the line `whatsapp_enabled: true`, and replace `true` with `false`.

**If you do not want the tracker to replace links to Telegram**, find the line `tgbot_enabled: true`, and replace `true` with `false`.

**If you do not want the tracker to replace links to Telegram bot**, find the line `tgbot_enabled: true`, and replace `true` with `false`.

#### Step 2: Embed the code on the website:

1. Copy the entire tracker code.
2. Paste the code at the end of your site's page (for example, before the closing body tag).

Example of code insertion:

```markup
<!DOCTYPE html>
<html lang="ru">
<head>
	<!-- Page contents -->
</head>
<body>
	<!-- Page contents -->
 
        <!-- Insert the code here -->
</body>
</html>
```

#### Conclusion

After completing all the steps, your site will collect analytics data and send it to Kommo in a message on WhatsApp and Telegram:&#x20;

<figure><img src="https://2698812344-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcL4cMgr32epKlKAkiQmx%2Fuploads%2FVAU8nDqc1uIbVoHM9NgS%2F4343.png?alt=media&#x26;token=4784cecd-08d9-4239-8412-da8e5c275e6b" alt=""><figcaption><p>An example in WA</p></figcaption></figure>

<figure><img src="https://2698812344-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcL4cMgr32epKlKAkiQmx%2Fuploads%2Fy1yYZklePPiEOOxWN95t%2FScreenshot%202024-10-01%20at%2014.56.27.png?alt=media&#x26;token=6f7fc1e7-b666-4311-846b-78f281a53d9a" alt=""><figcaption><p>An example in a Telegram bot</p></figcaption></figure>

### Where to find tags in a Kommo deal

The labels fall into the standard fields of Kommo. To view them, go to the "Statistics" tab in the transaction and expand the "Tags of statistical systems" section.&#x20;

<figure><img src="https://2698812344-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcL4cMgr32epKlKAkiQmx%2Fuploads%2FyZHqg8AzrMcfKYvNMjxj%2Fvr.png?alt=media&#x26;token=ca7bce07-3462-495a-9138-00769fbba44f" alt=""><figcaption></figcaption></figure>

### Limitations

The fields are filled in only when the leade is created for the first time. If the visitor writes to you again, and the lead with them in Kommo already exists, then the fields will not be filled in.

In order for the fields in Kommo to be filled in, in the integration settings, the creation of leads must be configured in any status **except** **Incoming Leads**.&#x20;

<figure><img src="https://2698812344-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcL4cMgr32epKlKAkiQmx%2Fuploads%2FR1n9117BU2L3iKP4wbWc%2FScreenshot%202024-10-01%20at%2015.02.08.png?alt=media&#x26;token=6eefaabf-0603-41bf-b4e8-19e2b484a751" alt=""><figcaption></figcaption></figure>

### Checking the connection status:

You can check the connection status of our tracker to your site in our personal [RadistWeb](https://radist.online/en) account, in the Analytics section.

More detailed information about this section and how to work in it can be found in the instructions: [LINK](https://docs.radist.online/docs/our-products/radist-web/analytics)
