---
title: Tracking Scripts
slug: tracking-scripts
description: Learn how to redirect users to a specific webpage after capturing their contact details in a chatbot with this comprehensive document. Discover how to easily implement the necessary code in the tracking script field within the Webhooks and integrations se
docTags: 
createdAt: 2021-07-06T11:13:12.000Z
---

Tracking scripts is a JS script that is read after the chatbot collected a lead.

# How can I redirect the user to a webpage after collecting the lead?

To redirect the user to another page after the user leaves his contact details, you can add this code to the tracking script field, under [Webhooks and integrations](docId\:YkzN6zkg8T31tO5c0pO0M).

Change the URL accordingly:

```javascript
  window.location.href= 'https://serviceform.com';
```



:::hint{type="info"}
## CRM Integrations

if you have a CRM integration, you might want to consider waiting a bit before the task proceeds. This way you will guarantee that the information had 'time' to get to the CRM. Read more below.&#x20;
:::


If you want the user to wait for a bit, just try adding a setTimeout:

```javascript
setTimeout(function(){ 
  window.location.href= 'https://www.serviceform.com';
}, 2000);
```

Don't forget to change the URL accordingly, you can also change the timeout (now it will redirect after 2 seconds).

