> ## Documentation Index
> Fetch the complete documentation index at: https://octanist.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Analytics 4

> Send your closed, open, and converted leads to Google Analytics 4 to track their origins.

## Table of Contents

1. [Overview](#1-overview)
2. [How the Measurement Protocol Works](#2-how-the-measurement-protocol-works)
3. [Setup Instructions](#3-setup-instructions)
4. [Additional Reporting in Google Analytics 4](#4-additional-reporting-in-google-analytics-4)

## Setup Video

Need help setting up offline conversion tracking for GA4? \
Watch the video below, it explains all the steps in detail:

<iframe src="https://www.youtube.com/embed/2V7NdweEnWY" title="YouTube video player" frameborder="0" className="w-full aspect-video rounded-xl" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen />

## 1. Overview

The Google Analytics 4 (GA4) integration sends your marked closed, open, and converted leads to Google Analytics 4. This process uses the [Google Analytics 4 Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/ga4). This server-to-server solution ensures all quantitative lead data is sent to Google Analytics 4 and tied to specific channels. No personal or client data is sent to Google Analytics 4.

<Warning>
  **Note:** While the Measurement Protocol sends 100% of the data to Google Analytics 4, it may face challenges linking data back to a user or session. The handling of the Client ID and Session ID is managed by Octanist. Events sent through the Measurement Protocol may result in "(not set)" values for source/medium attribution.
</Warning>

## 2. How the Measurement Protocol Works

1. **"Won" Leads:** Whenever a lead is marked as "Won," the event is sent to Google Analytics 4 along with corresponding parameters (e.g. the **value** and **currency**).
2. **"Open" Leads:** When a value is added or updated for an "Open" Lead, the event is sent to Google Analytics 4. The content of the note is passed as the parameter `lead_status`.
3. **"Lost" Leads:** If a lead does not convert and is marked as "Lost," the event is sent. The parameter `unconvert_lead_reason` contains the reason for the lost lead, based on the note content.

## 3. Setup Instructions

1. In your Octanist account, go to **Integrations > Search for "Google Analytics 4"**.

   <Frame>
     <img src="https://mintcdn.com/octanist/nqGyEKixNQz-Zkmb/images/octanist-google-analytics-4-select-integration.png?fit=max&auto=format&n=nqGyEKixNQz-Zkmb&q=85&s=07d9da4d1069aebec02329e85f9e7d09" alt="Octanist Google Analytics 4 Select Integration" width="1068" height="414" data-path="images/octanist-google-analytics-4-select-integration.png" />
   </Frame>
2. Add the integration by clicking **Add Integration**.

   <img src="https://mintcdn.com/octanist/nqGyEKixNQz-Zkmb/images/octanist-google-analytics-4-enter-credentials.png?fit=max&auto=format&n=nqGyEKixNQz-Zkmb&q=85&s=2efcfb517ba18997d09e8472f48f1f91" alt="" width="1289" height="690" data-path="images/octanist-google-analytics-4-enter-credentials.png" />
3. Enter your **GA4 Measurement ID**.
   * This can be found in your GA4 account under **Data Streams**. See [Google's guide](https://support.google.com/analytics/answer/12270356?hl=en) for details.

     <img src="https://mintcdn.com/octanist/21tMtwxs6Z1fFHqy/images/google-analytics/3-4-ga4-measurement-id.png?fit=max&auto=format&n=21tMtwxs6Z1fFHqy&q=85&s=ce75249f86bf6ea329964beacf70c0ba" alt="" width="1590" height="667" data-path="images/google-analytics/3-4-ga4-measurement-id.png" />
4. Enter your **GA4 API Key**:

   * In your GA4 Data Stream, click **Measurement Protocol API Secrets** *(you must have administrator access).*
   * If required, click **Review Terms** and then **I Acknowledge** after reading the User Data Collection Acknowledgment.

   <img src="https://mintcdn.com/octanist/21tMtwxs6Z1fFHqy/images/google-analytics/3-5-measurement-protocol-api-secrets.png?fit=max&auto=format&n=21tMtwxs6Z1fFHqy&q=85&s=ec037d373e8f1c1696a434482c5a1583" alt="" width="1602" height="953" data-path="images/google-analytics/3-5-measurement-protocol-api-secrets.png" />

   * Create a key and give it a clear name (e.g., *Octanist - GA4 Integration*).

   <img src="https://mintcdn.com/octanist/21tMtwxs6Z1fFHqy/images/google-analytics/3-5-d-measurement-protocol-api-secrets-copy-secret-value.png?fit=max&auto=format&n=21tMtwxs6Z1fFHqy&q=85&s=af8c2a3962cd247552fa66378228449c" alt="" width="949" height="284" data-path="images/google-analytics/3-5-d-measurement-protocol-api-secrets-copy-secret-value.png" />
5. Click **Create Google Analytics 4 Integration**.

Now, whenever you mark a lead as qualified, won, or lost, it will be sent to GA4 as follows:

* Qualified = `working_lead`
* Won = `close_convert_lead`
* Lost = `close_unconvert_lead`

These names follow the suggested naming conventions in the Google Analytics documentation.

## 4. Additional Reporting in Google Analytics 4

Add the [custom dimensions](https://support.google.com/analytics/answer/14240153?hl=en) `lead_status` and `unconvert_lead_reason` to view the text values of your notes entered in Octanist.

**Enter the custom dimensions as follows:**

* **Dimension Name**: The name of the dimension (e.g., `lead_status`; you can name this as you prefer).
* **Description**: A description of the custom dimension (e.g., *"The status of a lead (e.g., 'Called lead, waiting for follow-up')."*).
* **Event Parameter**: This must be `lead_status` or `unconvert_lead_reason` for Octanist Insights.

<img src="https://mintcdn.com/octanist/21tMtwxs6Z1fFHqy/images/google-analytics/custom-dimension.png?fit=max&auto=format&n=21tMtwxs6Z1fFHqy&q=85&s=23a55650e3687c433547ac71c8d32b12" alt="" width="1708" height="728" data-path="images/google-analytics/custom-dimension.png" />

To improve reporting, mark the `close_convert_lead` event as a **Key Event (Conversion)** in GA4. This will help you better understand the user journey and simplify reporting.

<img src="https://mintcdn.com/octanist/21tMtwxs6Z1fFHqy/images/google-analytics/key-event.png?fit=max&auto=format&n=21tMtwxs6Z1fFHqy&q=85&s=c4aa35cdfa3b5681c3bf3666b84c34b7" alt="" width="1700" height="594" data-path="images/google-analytics/key-event.png" />
