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

# Third-party Analytics

> Track page views and e-commerce events on your Dodo Payments-hosted pages with Google Analytics 4, Google Tag Manager, and Meta Pixel.

<Frame>
  <img src="https://mintcdn.com/dodopayments/OJISfHo1pPGtWHk9/images/analytics-cover.png?fit=max&auto=format&n=OJISfHo1pPGtWHk9&q=85&s=6f9b234fb9bb78755cd79b315e594826" alt="Analytics Integration" style={{ maxHeight: '500px', width: 'auto' }} width="2866" height="1436" data-path="images/analytics-cover.png" />
</Frame>

Track customer journeys from your storefront through checkout to purchase completion. Dodo Payments integrates with Google Analytics 4, Google Tag Manager, and Meta Pixel to provide comprehensive analytics across all your hosted pages.

<Info>
  Analytics tracking is automatically enabled on your Storefront, Checkout pages, and Customer Portal once you add your tracking IDs in the dashboard.
</Info>

<Warning>
  Ad blockers in customer browsers can prevent analytics tracking from working for some visitors to your store.
</Warning>

## Supported Platforms

<CardGroup cols={3}>
  <Card title="Google Analytics 4" icon="chart-simple">
    Page views and e-commerce tracking with GA4.
  </Card>

  <Card title="Google Tag Manager" icon="tags">
    Add and manage marketing tags.
  </Card>

  <Card title="Meta Pixel" icon="meta">
    Track Facebook and Instagram ad conversions.
  </Card>
</CardGroup>

## Getting Started

<Steps>
  <Step title="Open Business Settings">
    In your Dodo Payments dashboard, navigate to **Settings → Business** and scroll to the **Analytics** section.
  </Step>

  <Step title="Enable Your Tracking Platform">
    Toggle on the analytics platform you want to use and enter your tracking ID:

    * **Google Analytics**: Enter your Measurement ID (format: `G-XXXXXXXXXX`)
    * **Google Tag Manager**: Enter your Container ID (format: `GTM-XXXXXXX`)
    * **Meta Pixel**: Enter your Pixel ID (numeric, 10-20 digits)
  </Step>

  <Step title="Save Your Settings">
    Click **Save** to apply your tracking configuration.
  </Step>

  <Step title="Verify Tracking">
    Visit your storefront or create a test checkout to verify events are being tracked in your analytics dashboard.
  </Step>
</Steps>

## Google Analytics 4

[Google Analytics 4](https://marketingplatform.google.com/about/analytics/) provides comprehensive web analytics with e-commerce tracking capabilities. With Dodo Payments integration, you can track the complete customer journey from browsing your store to completing a purchase.

### Add Your Google Analytics Measurement ID

1. In Google Analytics, go to **Admin** → **Data Streams** → select your web stream
2. Copy the **Measurement ID** (starts with `G-`)
3. In Dodo Payments dashboard, go to **Settings** → **Business** → **Analytics**
4. Toggle on **Google Analytics** and paste your Measurement ID
5. Click **Save**

<Tip>
  If you don't have a Google Analytics property yet, follow [Google's setup guide](https://support.google.com/analytics/answer/9304153) to create one.
</Tip>

### Events Tracked in Google Analytics

We track the following events on your hosted storefront and checkout pages. Event data including product information, transaction totals, and currency are sent with each event.

#### Storefront Events

| Event            | Description                                                 |
| ---------------- | ----------------------------------------------------------- |
| `view_item_list` | Fires when the storefront page loads with products          |
| `select_item`    | Fires when a customer clicks on a product to start checkout |

#### Checkout Events

| Event               | Description                                                  |
| ------------------- | ------------------------------------------------------------ |
| `view_item`         | Fires when the checkout page loads                           |
| `view_cart`         | Fires when the checkout loads and when a variant is selected |
| `apply_discount`\*  | Fires when a valid discount code is successfully applied     |
| `remove_discount`\* | Fires when a discount code is removed                        |
| `add_payment_info`  | Fires when the customer submits the payment form             |
| `purchase`          | Fires when payment is successful                             |

<Note>
  `apply_discount` and `remove_discount` are custom events not included in the [standard Google Analytics e-commerce events](https://support.google.com/analytics/answer/9267735).
</Note>

### Using GA4 with Overlay/Inline Checkout

To track Google Analytics events in overlay or inline checkout embedded on your own website, you need to install the Google Analytics tracking code on your website where the checkout is embedded.

Once installed, all tracking events listed above will be sent to your Google Analytics account automatically - no additional configuration needed.

## Google Tag Manager

[Google Tag Manager](https://marketingplatform.google.com/about/tag-manager/) lets you manage marketing and analytics tags without modifying code. Tags deployed through GTM will fire on all Dodo Payments-hosted pages.

### Add Your GTM Container ID

1. In Google Tag Manager, copy your **Container ID** (starts with `GTM-`)
2. In Dodo Payments dashboard, go to **Settings** → **Business** → **Analytics**
3. Toggle on **Google Tag Manager** and paste your Container ID
4. Click **Save**

<Info>
  When using GTM, you can configure additional tracking (like Google Ads conversions) directly in your GTM container. The Dodo Payments integration injects both the GTM script and the noscript fallback for maximum compatibility.
</Info>

### Using GTM with Overlay/Inline Checkout

For overlay or inline checkout embedded on your website, install GTM on your own site. The checkout will inherit your GTM configuration and fire events within the embedded frame.

## Meta Pixel

[Meta Pixel](https://www.facebook.com/business/tools/meta-pixel/) tracks customer actions on your store to measure the effectiveness of your Facebook and Instagram ad campaigns. Track conversions from ad click to purchase completion.

### Add Your Meta Pixel ID

1. In [Meta Events Manager](https://www.facebook.com/events_manager2/), create or select your Pixel
2. Copy the **Pixel ID** (numeric, typically 15-16 digits)
3. In Dodo Payments dashboard, go to **Settings** → **Business** → **Analytics**
4. Toggle on **Meta Pixel** and paste your Pixel ID
5. Click **Save**

<Tip>
  Follow Meta's [Pixel setup guide](https://www.facebook.com/business/help/952192354843755) if you haven't created a Pixel yet.
</Tip>

### Events Tracked with Meta Pixel

We track the following events which appear in your [Meta Events Manager](https://www.facebook.com/events_manager2/). Event data including content IDs, values, and currency are sent with each event.

<Note>
  Events may not appear immediately in Meta Events Manager - there can be a delay of several minutes.
</Note>

#### Storefront Events

| Event              | Description                                                 |
| ------------------ | ----------------------------------------------------------- |
| `PageView`         | Fires when the storefront page loads                        |
| `ViewContent`      | Fires when the storefront loads with products               |
| `InitiateCheckout` | Fires when a customer clicks on a product to start checkout |

#### Checkout Events

| Event              | Description                                                  |
| ------------------ | ------------------------------------------------------------ |
| `PageView`         | Fires when the checkout page loads                           |
| `AddToCart`        | Fires when the checkout loads and when a variant is selected |
| `ApplyDiscount`\*  | Fires when a valid discount code is successfully applied     |
| `RemoveDiscount`\* | Fires when a discount code is removed                        |
| `AddPaymentInfo`   | Fires when the customer submits the payment form             |
| `Purchase`         | Fires when payment is successful                             |

<Note>
  `ApplyDiscount` and `RemoveDiscount` are custom events not included in [Meta's standard events](https://developers.facebook.com/docs/meta-pixel/reference#standard-events).
</Note>

## Complete Events Reference

This table shows all events tracked across both Google Analytics 4 and Meta Pixel:

| Trigger                      | GA4 Event          | Meta Pixel Event   | Location   |
| ---------------------------- | ------------------ | ------------------ | ---------- |
| Storefront page loads        | `view_item_list`   | `ViewContent`      | Storefront |
| Customer clicks product      | `select_item`      | `InitiateCheckout` | Storefront |
| Checkout page loads          | `view_item`        | `AddToCart`        | Checkout   |
| Cart viewed/variant selected | `view_cart`        | -                  | Checkout   |
| Discount code applied        | `apply_discount`   | `ApplyDiscount`    | Checkout   |
| Discount code removed        | `remove_discount`  | `RemoveDiscount`   | Checkout   |
| Payment form submitted       | `add_payment_info` | `AddPaymentInfo`   | Checkout   |
| Payment successful           | `purchase`         | `Purchase`         | Checkout   |

## Platform Coverage

Analytics tracking is available across different Dodo Payments surfaces:

| Surface                     | Google Analytics 4 | Google Tag Manager | Meta Pixel |
| --------------------------- | ------------------ | ------------------ | ---------- |
| Storefront                  | Yes                | Yes                | Yes        |
| Checkout (Hosted)           | Yes                | Yes                | Yes        |
| Checkout (Overlay/Inline)\* | Yes                | Yes                | Yes        |
| Customer Portal             | Yes                | Yes                | No         |

<Info>
  \*For overlay and inline checkout, install the tracking code on your own website for full attribution. Events from the embedded checkout will be tracked automatically.
</Info>

## Event Data Included

Each tracking event includes relevant e-commerce data to help you analyze customer behavior:

### Product Data

* Product ID
* Product name
* Price
* Currency
* Quantity

### Transaction Data (Purchase Events)

* Transaction/Payment ID
* Total amount
* Tax amount
* Currency
* Discount applied

### Customer Data

* Customer ID (for returning customers)
* Email (hashed for privacy where applicable)

## Best Practices

<AccordionGroup>
  <Accordion title="Test Your Integration">
    After adding your tracking IDs, visit your storefront and complete a test checkout to verify events appear in your analytics dashboards. Use Google Analytics Realtime reports or Meta Events Manager's Test Events feature.
  </Accordion>

  <Accordion title="Use UTM Parameters">
    Add UTM parameters to your marketing links to track which campaigns drive conversions. Dodo Payments preserves UTM parameters throughout the checkout flow.
  </Accordion>

  <Accordion title="Set Up Conversion Goals">
    In Google Analytics, create conversion events for `purchase` to track your conversion rate. In Meta Ads Manager, use the `Purchase` event as your optimization goal for campaigns.
  </Accordion>

  <Accordion title="Enable Enhanced E-commerce">
    If using Google Tag Manager, consider setting up Enhanced E-commerce reports for detailed funnel analysis and product performance metrics.
  </Accordion>
</AccordionGroup>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Events not appearing in Google Analytics">
    * Verify your Measurement ID is correct (format: `G-XXXXXXXXXX`)
    * Check Google Analytics Realtime reports - events appear there first
    * Ensure the toggle is enabled in your Dodo Payments settings
    * Wait a few minutes as there can be processing delays
    * Test in an incognito window to rule out ad blockers
  </Accordion>

  <Accordion title="Events not appearing in Meta Events Manager">
    * Verify your Pixel ID is correct (numeric, 10-20 digits)
    * Use the Meta Pixel Helper browser extension to debug
    * Check the Test Events tab in Events Manager
    * Events can take several minutes to appear
    * Ensure ad blockers are disabled during testing
  </Accordion>

  <Accordion title="GTM tags not firing">
    * Confirm your Container ID is correct (format: `GTM-XXXXXXX`)
    * Use GTM Preview mode to debug tag firing
    * Check that triggers are configured correctly in your GTM container
    * Verify the container is published (not just in draft)
  </Accordion>

  <Accordion title="Overlay/Inline checkout not tracking">
    * Install the tracking code on your own website first
    * Ensure the tracking loads before the checkout overlay opens
    * Check browser console for any JavaScript errors
    * Verify cross-domain tracking is configured if using GA4
  </Accordion>

  <Accordion title="Purchase events showing wrong amounts">
    * Amounts are sent in the smallest currency unit (cents)
    * Verify your analytics tool is configured to display the correct currency
    * Check if tax is included/excluded as expected
  </Accordion>
</AccordionGroup>

## Related Resources

<CardGroup cols={2}>
  <Card title="Segment Integration" icon="chart-line" href="/integrations/segment">
    Send payment events to Segment for advanced analytics and CDP integration.
  </Card>

  <Card title="Dub Integration" icon="https://mintcdn.com/dodopayments/LYWHtNbGSpS1P01t/images/logos/dub.svg?fit=max&auto=format&n=LYWHtNbGSpS1P01t&q=85&s=c36ca87c0811f65b3d8a4a79e4a34242" href="/integrations/dub" width="64" height="64" data-path="images/logos/dub.svg">
    Track sale conversions and affiliate attribution with Dub.
  </Card>

  <Card title="Customer.io Integration" icon="envelope" href="/integrations/customer-io">
    Trigger automated email campaigns based on payment events.
  </Card>

  <Card title="Webhooks" icon="webhook" href="/developer-resources/webhooks">
    Build custom analytics integrations with webhook events.
  </Card>
</CardGroup>
