---
title: "Google Analytics"
url: "https://help.magicblocks.ai/en/article/how-to-track-magicblocks-ai-agent-goals-in-google-analytics"
language: "en"
last_updated: "2025-11-18T15:09:28.348Z"
---

# Google Analytics

Want to know exactly how your AI Agent is performing?

With just a few clicks, you can connect Google Analytics (GA) to MagicBlocks and start tracking real-time goal completions all inside your GA dashboard.

This tutorial walks you through the full setup so you can start measuring what matters.

## **Step 1: Connect Google Analytics to MagicBlocks**

To get started, go to:

**Library > Connections**![1](https://export.supademo.com/renders/utd5hsptpt/out.png)   
![2](https://export.supademo.com/renders/fujiwq6lz1/out.png)→ Click **“Connect”** on Google Analytics ![3](https://export.supademo.com/renders/jfgwt1vuuk/out.png)  
→ Click **“Create New Connection”**![4](https://export.supademo.com/renders/f0fclsfy1u/out.png)

### Check the first few steps to connect Google Analytics to MagicBlocks:

You'll be prompted to enter:

-   **Google Analytics Name**
-   **Measurement ID** – Found in your Google Analytics > Admin > Data Streams > Web Stream Details
-   **API Secret** – Found under Measurement Protocol API Secrets in Google Analytics

This is how you will find Measurement ID and API Secret on Google Analytics:

Fill them out and click ‘**Create**’. Once connected, this integration will be available whenever you set a goal.

## **Step 2: Assign Google Analytics to a MagicBlocks Goal**

Navigate to **Library >** **Goals** in MagicBlocks![2](https://export.supademo.com/renders/nelbq8pfdo/out.png)

Click ‘**Create New**’ to create a new Goal![3](https://export.supademo.com/renders/gyhef5tk8z/out.png)

Fill out the **Goal Name**  ([Play Now](https://media.supademo.com/cm19x0p5f02uu28fi5k0t2b3e/videos/n4MKpidfNm2Yx1lr298Zy.mp4)) and **Conversion Value** ([Play Now](https://media.supademo.com/cm19x0p5f02uu28fi5k0t2b3e/videos/XARSdgfKxV-bYISoX0oMN.mp4))![4](https://export.supademo.com/renders/n6xr6gf3fp/out.png)![6](https://export.supademo.com/renders/yscv33ujry/out.png)

Under the **"Connect Analytics"** section, select the GA account you just linked![8](https://export.supademo.com/renders/ma9rzoete0/out.png)![9](https://export.supademo.com/renders/b8torj0co7/out.png)

Click **Create**

This ties your MagicBlocks Goal directly to your GA events dashboard.![10](https://export.supademo.com/renders/5fyvbt9zsj/out.png)

## **Step 3: Link the Goal to a Conversation Block**

Go to **Agents** and open one of your Agents![12](https://export.supademo.com/renders/5dr8ws1tzd/out.png)

Choose the **Block** where your goal should trigger (e.g., a final confirmation message or CTA success)![13](https://export.supademo.com/renders/lmgojku1qt/out.png)

Inside the **Actions** panel:![11](https://export.supademo.com/renders/845rlrc5vh/out.png)![14](https://export.supademo.com/renders/1ct4vqlf9s/out.png)![15](https://export.supademo.com/renders/dgqov48r2l/out.png)![16](https://export.supademo.com/renders/5dksfo8mw9/out.png)

Select **Goal**![17](https://export.supademo.com/renders/5suh52hx6a/out.png)![18](https://export.supademo.com/renders/wfvs20i1gv/out.png)![7](https://export.supademo.com/renders/je4dv6h982/out.png)

Choose your **Google Analytics Goal**![19](https://export.supademo.com/renders/a24aisbans/out.png)

**Save or Publish the Agent**

### After linking the Goal to the Block, you need to save or publish the Agent to ensure all changes are applied.![21](https://export.supademo.com/renders/vbzf28ioq7/out.png)

**Test the Agent**

Interact with the Agent to trigger the Goal. Once the Goal is completed, MagicBlocks will send the event goal\_completed to the connected Google Analytics account.

**Check in Google Analytics**

After the Goal is completed in the Agent, go to your Google Analytics account to verify that the event is being tracked.

Now, every time this goal is reached, MagicBlocks will fire the connected GA event.

## **Step 4: Google Analytics Event Tracking when the Goal is completed**

When a **goal** is completed by the AI Agent, the **goal\_completed** event is automatically triggered and sent to **Google Analytics**. in 24 hours.

### **Viewing the Event in Google Analytics**

To view the **goal\_completed** event data:

-   Go to **Google Analytics 4 > Reports > Engagement > Events**.
-   Search for or filter by the event name **"goal\_completed"**.
-   Track the count, user activity, and time of each conversion.

By connecting MagicBlocks to Google Analytics, you get **full visibility** into your goal completion metrics, providing data-backed insights into your AI's performance. 

The event will have a delayed time as we checked within 24 hours.
