# Google Analytics

You can add Google Analytics events to track different actions taken in your quiz. The events that you can track are: quiz started, question answered, quiz completed, product added to cart, and customer subscribed.

{% hint style="info" %}
**Note:**&#x20;

If you’re on a legacy Quiz Kit plan, then this feature is available for the **Middle** plan or higher.
{% endhint %}

## In this section

* [Before you begin](#before-you-begin)
* [Connecting Quiz Kit to Google Analytics](#connecting-quiz-kit-to-google-analytics)
* [Creating custom events in Quiz Kit](#creating-custom-events-in-quiz-kit)
* [Adding custom tags to Google Tag Manager](#adding-custom-tags-to-google-tag-manager)
  * [Part 1: Create a trigger](#part-1-create-a-trigger)
  * [Part 2: Create a custom tag](#part-2-create-a-custom-tag)

***

## Before you begin

Before you begin, you need to ensure that you've enabled Google Analytics 4 for your store. You can learn more about how to get set up with [Google Analytics 4 on Shopify](https://help.shopify.com/en/manual/reports-and-analytics/google-analytics/google-analytics-setup).

***

## Connecting Quiz Kit to Google Analytics

**Steps:**

1. From the Quiz Kit dashboard, click **Integrations**.
2. On the **Analytics & Tracking** tab, go to **Google Analytics.**
3. Click **Enable**.

***

## Creating custom events in Quiz Kit

**Steps:**

1. From the quiz builder, click **Settings**.
2. Click **Tracking**.
3. Click the **Google Analytics** tab, and enter any custom event names for tracking information that you want. For example, for the quiz started event, you can write `quiz-started` .
4. Click **Save**.

{% hint style="info" %}
**Note:**

It's important to take note of the **event name** you created for each event.&#x20;

You need to copy and paste this event name in the trigger and tag setup of your Google Tag Manager, in order to have this event track properly.
{% endhint %}

***

## Adding custom tags to Google Tag Manager

### Part 1: Create a trigger

The first step in creating and tracking an event is to create the trigger in Google Tag Manager (GTM).

**Steps:**

1. From your GTM account, click **Triggers.**
2. Click **New**.&#x20;
3. Give your trigger a name so you can identify it later, for example, `Quiz started`.
4. Click under **Trigger configuration** to open the side panel.
5. Click **Custom event**.&#x20;
6. Under **Event name**, copy and paste the event name that you created in your Quiz Kit app. In this example, the event name is `quiz-started`.&#x20;
7. Click **Save**.

### Part 2: Create a custom tag

Next, you need to create a custom tag that references the trigger that you created in the previous section.&#x20;

{% hint style="info" %}
**Note**:\
\
You need your Measurement ID to complete this step.&#x20;

You can find your measurement ID in your Google Analytics 4 account under **Admin** > **Property** > **Data streams** > then click your website domain, and copy your Measurement ID.
{% endhint %}

**Steps:**

1. From your GTM account, click **Tags.**
2. Click **New**.&#x20;
3. Give your tag a name so you can identify it later, for example, `Quiz started`.
4. Click under **Tag configuration** to open the side panel.
5. Click **Google Analytics**, then click **Google Analytics 4**.
6. In the Measurement ID field, enter your ID.&#x20;
7. Under **Event name**, copy and paste the event name that you created in your Quiz Kit app. In this example, the event name is `quiz-started`.&#x20;
8. Click under **Triggers** and select the trigger that you created in the last section. &#x20;
9. Click **Save**.

This event is now being tracked.&#x20;

Repeat the steps in Part 1 and 2 for each event that you want Google Analytics to track.

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


---

# 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://support.quizkitapp.com/building-a-quiz/integrations/analytics-and-tracking/google-analytics.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.
