# Connect Google Analytics 4 (Legacy)

{% hint style="info" %}
**PageFly Analytics now works without Google Analytics.** You can track all page metrics natively. See [Enable PageFly Analytics](https://help.pagefly.io/page-structure-and-elements/analytics/page-analytics/enable-pagefly-analytics) to get started with the recommended approach.

If you prefer to continue using GA4, the instructions below still apply.
{% endhint %}

***

## Before you start

Make sure you have:

1. **A Google Analytics 4 property** — if you don't have one, follow [Google's GA4 setup guide](https://support.google.com/analytics/answer/9304153)
2. **Editor or Admin permissions** on the GA4 property — check in GA4: **Admin > Property access management**
3. **Matching currencies** — GA4 currency should match your Shopify store's currency (GA4: **Admin > Property details > Currency**)
4. **User Data Collection terms acknowledged** — required for revenue tracking

***

## How to connect

### Step 1: Open the connection settings

1. Click **Analytics** in PageFly's left sidebar
2. Click the **Google Analytics 4** connection box or the **Connect GA4** link on the banner

### Step 2: Sign in with Google

1. A Google sign-in pop-up appears
2. Grant PageFly **all requested permissions** to access your GA4 data
3. If you deny any permission, the connection fails — start over

### Step 3: Select your GA4 account

Choose from three dropdowns:

1. **Account** — your GA4 account
2. **Property** — the GA4 property for your Shopify store
3. **Data Stream** — the web data stream tracking your storefront

### Step 4: Save

Click **Select** to confirm. PageFly verifies the connection and shows a green "Connected" badge.

***

## Common errors

| Error                                           | Cause                                    | Fix                                                                                                |
| ----------------------------------------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------- |
| "No accounts found"                             | Google account lacks GA4 access          | Ask your GA4 admin to grant Editor/Admin role                                                      |
| "No properties found"                           | Account has no GA4 properties            | Create a property in GA4 Admin                                                                     |
| "No data streams found"                         | Property has no web stream               | Create a web data stream in GA4                                                                    |
| "Missing access"                                | Insufficient permissions or denied OAuth | Reconnect and grant all permissions                                                                |
| "User Data Collection Acknowledgement Required" | Haven't accepted Google's data terms     | Go to GA4 > Admin > Data Streams > select stream > Measurement Protocol API secrets > accept terms |

***

## If your connection drops

Common causes:

* **OAuth token expired** — tokens expire after \~6 months. Reconnect from the Analytics dashboard
* **GA4 permissions changed** — ask your admin to restore Editor access
* **Property deleted** — connect to the correct property

***

## GA4 vs PageFly Analytics

You can use both simultaneously, or choose one:

|                      | GA4 Integration                     | PageFly Analytics               |
| -------------------- | ----------------------------------- | ------------------------------- |
| **Setup**            | Connect Google account, grant OAuth | Check one box — done            |
| **Data delay**       | 24-48 hours                         | Under 5 minutes                 |
| **Section tracking** | Not available                       | Heatmaps, scroll depth, scores  |
| **AI co-pilot**      | Available (queries GA4 data)        | Available (queries native data) |
| **Dependency**       | Requires active GA4 account         | No external dependency          |

**Recommendation:** New merchants should use PageFly Analytics directly. Existing GA4 merchants can continue using GA4 or switch at any time.


---

# 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://help.pagefly.io/page-structure-and-elements/analytics/page-analytics/connect-google-analytics-4-ga4.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.
