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

# Connect Shopify to Google Analytics

> Connect Trylora success events to the Google Analytics 4 property already used by your Shopify store.

Use this guide to send Trylora success events to the same Google Analytics 4 (GA4) property that already measures your Shopify storefront. The connection is optional.

## Who completes each step

| Store owner                                                                              | Trylora                                                             |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| Confirm that Shopify sends storefront and ecommerce activity to the correct GA4 property | Save the GA4 Measurement ID and API secret in the Trylora dashboard |
| Create a Measurement Protocol API secret for the connected GA4 web stream                | Enable forwarding and maintain the Trylora App Pixel                |
| Share the Measurement ID and API secret through the agreed secure channel                | Confirm that the connection is configured and enabled               |
| Complete a new try-on and check GA4 Realtime                                             | Help troubleshoot event delivery                                    |

<Info>
  If Trylora manages your dashboard configuration, you do not need Trylora dashboard access. Complete the store-owner steps and send the two GA4 values to your Trylora contact.
</Info>

## Before you begin

You need:

* The Trylora Shopify app installed and active on the published theme
* A GA4 property that measures this Shopify store
* Access to the store's **Google & YouTube** app in Shopify admin
* **Editor** access or higher for the GA4 property so you can create an API secret

## 1. Connect Shopify to the correct GA4 property

If Shopify already sends storefront and ecommerce events to the intended GA4 property, confirm the connection and continue to the next section.

<Steps>
  <Step title="Open Google & YouTube in Shopify">
    In Shopify admin, open the **Google & YouTube** app. Install it from the Shopify App Store if the sales channel is not available.
  </Step>

  <Step title="Start Google Analytics setup">
    On the app's **Overview** page, find **Just want to set up Google Analytics 4** and select **Get started**.
  </Step>

  <Step title="Connect the existing property">
    Connect the Google account that owns the store's GA4 property. Select the property that should receive the store's ecommerce data, then select **Connect** and **Confirm**.
  </Step>

  <Step title="Confirm the Google tag">
    Confirm that the connected Google tag starts with `G-`. Keep this property connected while Trylora forwarding is enabled.
  </Step>
</Steps>

<Note>
  Use the store's existing GA4 property and web stream. This lets Trylora activity appear alongside the store's engagement, add-to-cart, purchase, and revenue events.
</Note>

For Shopify's complete GA4 setup flow, see [Setting up Google Analytics 4](https://help.shopify.com/en/manual/reports-and-analytics/google-analytics/google-analytics-setup).

## 2. Create the Trylora API secret

Create the secret on the same GA4 web stream connected to Shopify.

<Steps>
  <Step title="Open the connected web stream">
    In Google Analytics, select the correct property. Open **Admin → Data collection and modification → Data streams**, select **Web**, then open the stream used by the Shopify store.
  </Step>

  <Step title="Copy the Measurement ID">
    Copy the stream's **Measurement ID**. It starts with `G-`.
  </Step>

  <Step title="Create a Measurement Protocol API secret">
    In the web stream details, open **Measurement Protocol API secrets**. Accept the user-data acknowledgement if Google displays it, then select **Create**.
  </Step>

  <Step title="Name and copy the secret">
    Use `Trylora` as the nickname. Copy the generated **Secret value**.
  </Step>

  <Step title="Send the two values to Trylora">
    Share the `G-` Measurement ID and the generated API secret with your Trylora contact through the agreed secure channel.
  </Step>
</Steps>

The Measurement ID and API secret must come from the same web stream. See Google's [API secret instructions](https://support.google.com/analytics/answer/9814495) for the current GA4 interface.

## 3. Configure the Trylora dashboard

Trylora completes this section when we manage the connection for you.

<Steps>
  <Step title="Open the store's advanced settings">
    In the Trylora Shopify app, open **Settings**, then select **Open Advanced Settings**.
  </Step>

  <Step title="Open Analytics">
    In the store's **Settings** tab, find the **Analytics** card.
  </Step>

  <Step title="Enter the GA4 values">
    Enter the Measurement ID and Measurement Protocol API secret supplied by the store owner.
  </Step>

  <Step title="Enable forwarding">
    Turn on **Forward events to this store's GA4**, then select **Save GA4 Connection**.
  </Step>
</Steps>

The API secret is encrypted at rest. Trylora does not place it in the storefront widget, Shopify App Pixel, or storefront requests.

## 4. Verify with a new storefront event

<Steps>
  <Step title="Accept analytics consent">
    Open the published storefront and accept analytics consent if the store uses a consent banner.
  </Step>

  <Step title="Complete a new try-on">
    Open a product page and generate a new try-on image. Results created before the connection was enabled are not replayed.
  </Step>

  <Step title="Open GA4 Realtime">
    In the connected GA4 property, open **Reports → Realtime** and look for `trylora_tryon_succeeded`.
  </Step>

  <Step title="Optionally test animation">
    Generate a new animation and look for `trylora_animation_succeeded`.
  </Step>
</Steps>

Realtime processing can take several minutes. The Analytics card should also say that the connection is configured and enabled.

<Info>
  A real storefront event appearing in the intended GA4 property is the final connection check. Google's [Measurement Protocol validation endpoint](https://developers.google.com/analytics/devguides/collection/protocol/ga4/validating-events) does not validate the API secret.
</Info>

## Events sent to GA4

| Result                         | GA4 event                     |
| ------------------------------ | ----------------------------- |
| New try-on image becomes ready | `trylora_tryon_succeeded`     |
| New animation becomes ready    | `trylora_animation_succeeded` |

Both events include `trylora_product_url`. They include `trylora_product_title` when it is available. They do not contain the shopper's photo or generated media.

No additional Shopify code is required. The Trylora Shopify app installs and maintains its App Pixel automatically, and the pixel runs according to Shopify analytics consent.

## Optional: grant reporting access

Event delivery does not require Google OAuth or access to your GA4 account. If you want Trylora to prepare an impact report, grant `admin@trylora.app` the **Analyst** role for this GA4 property.

Follow [Share GA4 access for Trylora reports](/reference/ga4-reporting-access) after event delivery is working.

## Final checklist

* [ ] Shopify is connected to the intended GA4 property through Google & YouTube
* [ ] The Measurement ID and API secret belong to the same web stream
* [ ] Trylora has saved the values and enabled forwarding
* [ ] A new `trylora_tryon_succeeded` event appears in GA4 Realtime
* [ ] Analyst access is granted only when Trylora will prepare reports

If an event does not appear, follow the [analytics troubleshooting checklist](/reference/troubleshooting#analytics-events-do-not-appear). For event fields, see [Analytics events](/reference/analytics-events).
