> For the complete documentation index, see [llms.txt](https://docs.spara.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spara.com/integrations/google-analytics-4-ga4-integration.md).

# Google Analytics 4 (GA4) Integration

How Spara integrates with Google Analytics 4.

Spara fires conversion events into Google Analytics 4 so you can measure how much pipeline and revenue your AI conversations are driving. Once events are flowing, you can break down Spara conversions by traffic source, build funnel views, and pipe the same events into Google Ads or other ad platforms for smarter bidding.

The native integration sends five events to your GA4 property:

| Event name in GA4          | When it fires                                                 |
| -------------------------- | ------------------------------------------------------------- |
| `spara_loaded_via_spara`   | Spara loads on a page for a visitor                           |
| `lead_engaged_via_spara`   | A visitor sends their first message in a Spara conversation   |
| `email_captured_via_spara` | Spara captures a lead's email address (form, qualifier, etc.) |
| `calendar_shown_via_spara` | The booking calendar is displayed to the lead                 |
| `demo_scheduled_via_spara` | The lead books a meeting inside Spara                         |

## Choosing how to fire events

There are two ways to get Spara events into GA4. Pick one based on whether you need the events outside of GA4.

* **Spara native integration**: Spara sends the five events above directly from its servers to your GA4 property. Quick to set up and covers all five events, but events only land in GA4. Best when GA4 is your only destination.
* **JavaScript events via Google Tag Manager**: you subscribe to Spara's JavaScript events on your site and push them into the `dataLayer` yourself, under event names you choose. More setup, but the same event can fan out to GA4, Google Ads, Meta, LinkedIn, and any other tag you configure. Best for marketing teams running paid campaigns across multiple platforms.

{% hint style="warning" %}
Spara does not push anything into your page's `dataLayer` on its own. The native integration sends events server-side, so Google Tag Manager never sees them, and GTM triggers listening for the `_via_spara` event names will not fire. To use GTM, add the script in [#step-1-push-spara-events-into-the-datalayer](#step-1-push-spara-events-into-the-datalayer "mention").
{% endhint %}

The rest of this page covers both setup paths, then how to analyze the data once it's flowing.

## Option 1: Native integration

### Step 1: Authentication

{% hint style="info" %}
You must be a Manager- or Integrator-level user to manage third-party integrations.
{% endhint %}

Navigate to [**Settings > Integrations**](https://app.spara.co/settings/integrations) and click **Authorize** on the Google Analytics card to start the Google OAuth flow.

<figure><img src="https://4072969777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FreCGkFdsmuPJzGP9ZgGA%2Fuploads%2Fgit-blob-8bf4ae957c843c9f4d78274157a4c062770d9ccc%2FScreenshot%202026-01-16%20at%201.43.35%E2%80%AFPM.png?alt=media" alt=""><figcaption></figcaption></figure>

After granting access, Google may show an unverified-app warning. You can either wait for Google to verify the app (this can take a few days) or bypass it by selecting **Advanced > Go to Spara** to continue.

<figure><img src="https://4072969777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FreCGkFdsmuPJzGP9ZgGA%2Fuploads%2Fgit-blob-653da042fc98afe4b1e1ed9c85988db2009b0b59%2FScreenshot%202026-01-16%20at%2012.49.52%E2%80%AFPM.png?alt=media" alt="" width="375"><figcaption></figcaption></figure>

### Step 2: Configure Google Analytics

Select the GA4 property to receive Spara's conversion events and choose which of the five events to send.

<figure><img src="https://4072969777-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FreCGkFdsmuPJzGP9ZgGA%2Fuploads%2Fgit-blob-3f18dce6bdcf1e749a10b6adaf97ea40bbbaad91%2FGA4.png?alt=media" alt=""><figcaption></figcaption></figure>

That's it — Spara starts sending the selected events to your property on the next conversation.

## Option 2: Google Tag Manager

This path lets you forward Spara events to GA4 and any other tag in your container, such as Google Ads, Meta Pixel, or LinkedIn Insight Tag.

### Step 1: Push Spara events into the dataLayer

Add a script after the Spara embed script on your site that subscribes to Spara's events with `SparaActions` and pushes each one into the `dataLayer`. You choose the event names; the example below uses `spara_engaged`, `spara_email_captured`, and `spara_demo_scheduled`.

```html
<script type="text/javascript" src="https://app.spara.co/embed-<app_id>.js"></script>
<script>
  window.dataLayer = window.dataLayer || [];

  // onMessageSent fires on every message; only push the first one.
  var sparaEngaged = false;
  SparaActions.onMessageSent(function (e) {
    if (sparaEngaged) return;
    sparaEngaged = true;
    window.dataLayer.push({ event: 'spara_engaged', spara_form_factor: e.formFactor });
  });

  SparaActions.onEmailCaptured(function (e) {
    window.dataLayer.push({ event: 'spara_email_captured', spara_form_factor: e.formFactor });
  });

  SparaActions.onMeetingBooked(function (e) {
    window.dataLayer.push({ event: 'spara_demo_scheduled', spara_form_factor: e.formFactor });
  });
</script>
```

See [Developer: Javascript API](https://docs.spara.com/developers/spara-api/javascript-api) for every available event and its payload. To track when Spara loads, use the `Spara.onSparaLoad()` callback described on the same page.

{% hint style="info" %}
There is no JavaScript event for the booking calendar being shown, so a GTM-only setup cannot track the equivalent of `calendar_shown_via_spara`. Use the native integration if you need that event.
{% endhint %}

### Step 2: Get your GA4 Measurement ID

1. Log in to [analytics.google.com](https://analytics.google.com).
2. Click **Admin** (gear icon, bottom-left).
3. Navigate to **Data collection and modification > Data Streams**.
4. Open your website data stream and copy the **Measurement ID** (starts with `G-`).

### Step 3: Create the GA4 tag in GTM

1. Log in to [tagmanager.google.com](https://tagmanager.google.com) and open your workspace.
2. Click **Tags > New**.
3. Name the tag (e.g., `GA4 - Spara Event`).
4. Set **Tag Configuration > Google Analytics: GA4 Event**.
5. Paste your **Measurement ID** and set an **Event Name** (this is the name that appears in your GA4 reports — e.g., `spara_conversion`).

### Step 4: Configure the trigger

1. Click the **Triggering** box, then **+** to create a new trigger.
2. Name it (e.g., `Trigger - Spara Demo Booked`).
3. Set **Trigger Configuration > Custom Event**.
4. Set **Event Name** to the event name your script from Step 1 pushes (e.g., `spara_demo_scheduled`). The name must match your `dataLayer.push` call exactly.
5. **Save** the trigger.

To track multiple Spara events, repeat with a separate tag and trigger for each event name.

### Step 5: Publish

Save the tag, submit your container, and publish a new workspace version.

### Step 6: Verify with Preview mode

Before assuming everything works, test with GTM's **Preview** mode:

1. In your workspace, click **Preview** (top-right). Enter your site URL and click **Connect** — a new window opens with a "Tag Assistant Connected" badge.
2. In that window, perform the action Spara should fire for (e.g., book a demo through Spara).
3. Back in the Tag Assistant tab, look for your event name in the left-hand event list. Click it.
4. Under **Tags Fired**, confirm your GA4 - Spara Event tag is listed. If it's under **Tags Not Fired**, click in to see which trigger condition failed.

## Analyzing Spara conversions in GA4

Once events are flowing, mark `demo_scheduled_via_spara` as a primary conversion event in GA4 — a Spara-booked demo is the direct equivalent of a form-fill demo request and should be treated the same way in your reporting.

The examples below use the native integration's event names. If you send events through GTM, substitute the names your script pushes.

A few views that are worth knowing about:

* **Acquisition reports** — which traffic sources (paid, organic, social) drive Spara conversions.
* **Explore > Funnel exploration** — multi-step paths like "visited pricing → engaged with Spara → booked demo."
* **Explore > Segment overlap** — see which leads converted through Spara vs. through your form, and where they overlap.
* **Google Ads integration** — feed Spara conversion events back into Google Ads for smarter bidding.

{% hint style="info" %}
Keep your existing form-submit event firing alongside Spara events. Spara doesn't replace your form — and `lead_engaged_via_spara` often assists form fills that happen later in the session, after the lead's questions are answered.
{% endhint %}

### Building a funnel view

To see "did A then B at any point in the session" (not strictly adjacent steps), use a Funnel exploration:

1. Go to **Analytics > Explore > Blank exploration** and switch the **Technique** to **Funnel exploration**.
2. Click the ✏️ icon next to **STEPS** to open the funnel editor.
3. **Step 1**: name it `Session start`, add condition → event `session_start`. Leave "directly followed by" **off** so other events can occur in between.
4. **Step 2**: name it `Spara engaged`, add condition → event `lead_engaged_via_spara`.
5. **Step 3**: name it `Demo booked`, add condition → event `demo_scheduled_via_spara`.
6. Click **Apply**.

### Building a segment overlap

A segment overlap reveals whether the same users trigger two different events — useful for questions like "do leads who engage with Spara also book demos through our form?"

1. Go to **Analytics > Explore > Blank exploration** and switch the **Technique** to **Segment overlap**.
2. In the **Segments** panel, click **+ > New user segment**. Name it (e.g., "Triggered Event A"), set condition → **Event name exactly matches** `<event_a_name>`, save.
3. Repeat for the second event.
4. Drag both segments into the **Segments** slot of the **Tab settings** panel.
5. Optionally add a **Breakdown dimension**, set a date range — GA4 renders the Venn diagram and overlap table.

## Ad platform tracking: who owns what

Customers running paid ads almost always ask what Spara handles vs. what they need to wire up in GTM. Use this split.

**Your responsibility (in GTM and on your site):**

* **UTM parameters** — set these in your ad campaign URLs. Spara reads whatever is on the URL when a conversation starts.
* **Conversion pixels** — the Google Ads tag, Meta Pixel, LinkedIn Insight Tag, and others live in your GTM container and fire on the same Spara events. Map your demo-booked event (and any other Spara events you push) to each platform's conversion action.
* **Click IDs** — `gclid` (Google), `fbclid` (Meta), `li_fat_id` (LinkedIn), and `msclkid` (Microsoft) need to land on the page when Spara loads. Keep auto-tagging on and avoid redirects that strip them.
* **Cookie consent** — if you use a consent management platform (OneTrust, Cookiebot, etc.), you're responsible for the consent gate that allows Spara, GA4, and ad pixels to fire.

**Spara's responsibility:**

* Captures UTMs and click IDs present on the page when a conversation starts, stores them on the lead record, and includes them in lead exports.
* Sends the five events to GA4 when the native integration is connected, and exposes JavaScript events (`SparaActions`) that your site can push into the `dataLayer` for GTM.
* Passes lead data and attribution to your CRM.

## FAQ

### Which integration option should I pick?

If GA4 is your only destination, use the native integration — it takes minutes. If you're running paid ads on Google, Meta, LinkedIn, or any other platform that needs the same conversion signal, use GTM so a single event fans out to every tag in your container.

### Can I use both at once?

You can, but it's not recommended — you risk double-counting conversions. Pick the path that matches your reporting setup.

### Does Spara capture UTM parameters?

Yes. Spara captures UTMs and click IDs (`gclid`, `fbclid`, `li_fat_id`, `msclkid`) present on the page when a conversation starts, stores them on the lead record, and includes them in exports and CRM syncs.

### Which event should I mark as my primary conversion?

`demo_scheduled_via_spara` (or the demo-booked event your GTM script pushes). It's the direct equivalent of a demo-request form submit and should be treated the same way in GA4 and downstream ad platforms.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.spara.com/integrations/google-analytics-4-ga4-integration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
