---
title: Google Analytics
slug: google-analytics
description: Learn how to set up goals in Google Analytics using data from Serviceform tools with this step-by-step guide. Discover how to configure goals in the Admin section and customize them with custom settings. Find instructions on changing event names in chatbo
docTags: 
createdAt: 2021-07-15T15:22:03.000Z
---

All the information collected from the Serviceform tools will be automatically sent to the Google Analytics Account connected to the website.&#x20;

The information will firstly go to **Events**.

![](https://api.archbee.com/api/optimize/SRR7Dw6jlnoj-xk5jLa7o/rEuIm9pu0Phll13ej1wcc_image.png)

You can create the **Goals** using the data from the Chat Complete or Form submitted.


# Create Goals in Google Analytics using an Event



::loom{url="https://www.loom.com/share/a43203b0bd6042a39dd8bc9ca093ad6a"}



In your Google analytics account, go to '**Admin**' and then '**Goals**'.

![](https://api.archbee.com/api/optimize/SRR7Dw6jlnoj-xk5jLa7o/J7Ddd4ZkgUhDQQug3PPgL_screenshot-2021-07-15-at-172504.png)

Click on 'New Goal'.

::Image[]{src="https://api.archbee.com/api/optimize/SRR7Dw6jlnoj-xk5jLa7o/fRdvxJ9g1LqXgFvZCTqAp_image.png" size="24" width="236" height="82" position="flex-start" showCaption="false"}

Setup you goal, by using a Custom configuration.

![](https://api.archbee.com/api/optimize/SRR7Dw6jlnoj-xk5jLa7o/8e7k1Fq3hCR6a09mZKhKE_image.png)

In the Goal description add a Name and select the **Event** **type.**

![](https://api.archbee.com/api/optimize/SRR7Dw6jlnoj-xk5jLa7o/ng-DEsSoPABJ2ptMp40Rt_image.png)

In the goal detail add:

### For chatbots

- Category: Serviceform
- Action: Chat complete

### For popups

- Category: Serviceform
- Action: Popup lead

![](https://api.archbee.com/api/optimize/SRR7Dw6jlnoj-xk5jLa7o/dFqBusHKcWP9fR_XSzWId_image.png)

Save your Goal and it's all set.

###

# Change the Event name on your chatbot


Under **Settings** in the chatbot builder, you have the **Notification settings**, there, you can change the datalayers for both interactions or submissions.

![](https://api.archbee.com/api/optimize/SRR7Dw6jlnoj-xk5jLa7o/W_3nXSa1dfEdAAGqXzRW9_image.png)



## Create Goals in Google Analytics using different chatbot options&#x20;


For this you'll need to have basic undestanding of coding.

### 1. Think of the use cases that you need

Let’s say you want to seat as a goal “users who finished the submission and are interested in buying” or “users who finished the submission and are interested in recruitment processes”.

### 2. Add the Javascript

In the select one type of question paste the code in the Custom Javascript field, under the option 'show advanced seetings'.
For example, this for buyers:

:::BlockQuote
window\.sfGaOptions = \{ 
eventCategory: 'Chatbot option',
eventAction: 'click',
eventLabel: 'Buyers',
transport: 'beacon'
}
:::

And this for recruiting:

:::BlockQuote
window\.sfGaOptions = \{ 
eventCategory: 'Chatbot option',
eventAction: 'click',
eventLabel: 'Recruiting',
transport: 'beacon'
}
:::



### 3. Change the eventLabel according to the name you want to be displayed in GA

### 4. Paste this at the end of the bot in Custom JS, under Settings

:::BlockQuote
if (typeof ga === 'function') \{ 
&#x20; if ("ga" in window) \{ 
&#x20;   tracker = ga.getAll();
&#x20;     for (var i = 0; i \< tracker.length; i++) \{
&#x20;       if (tracker\[i]) \{
&#x20;       tracker\[i].send('event', sfGaOptions);
&#x20;     }
&#x20;   }
&#x20; }
}
:::

Do as many options as you like.

