> For the complete documentation index, see [llms.txt](https://docs.iheartjane.com/partner-success/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.iheartjane.com/partner-success/ecommerce-premium/premium-analytics.md).

# Premium Analytics

{% hint style="info" %}
We recommend that you configure either Google Tag Manager (GTM) or a direct GA4 Measurement ID for event tracking — not both.\
When both are configured simultaneously, events are sent through each integration independently, resulting in duplicate event data in your GA4 property. This inflates event counts, skews conversion metrics, and complicates attribution.
{% endhint %}

### **GA4**

1. Follow Google’s instructions on setting up GA4: <https://support.google.com/analytics/answer/9304153?hl=en&ref_topic=14088998&sjid=11424815829923614705-NA> (If already set up, skip to step 2)
2. To connect your Premium menu to GA4, find the “External Scripts” section in your Business Dashboard and add a script that looks like this: **(BE SURE TO REPLACE G-XXXXXX WITH YOUR GOOGLE TAG ID)**

{% code overflow="wrap" %}

```
 <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXX"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-XXXXXX'); </script>
```

{% endcode %}

<figure><img src="/files/deXxDtLbfDxt9eQxJttn" alt=""><figcaption></figcaption></figure>

### **Google Tag Manager**

Jane will broadcast analytics events when users interact with Premium menu pages and checkout. If you have [Google Tag Manager configured](https://support.google.com/tagmanager/answer/14842164), you can read these events from the global [dataLayer](https://developers.google.com/tag-platform/tag-manager/datalayer). We have done our best to match Google Analytics’ [recommended event taxonomy](https://developers.google.com/analytics/devguides/collection/ga4/reference/events?client_type=gtm).

{% hint style="info" %}
Reminder to setup Google Tag Manager under your Google Add On settings.&#x20;

More information here: [Google Add Ons](/partner-success/ecommerce-premium/premium-menu-settings.md#google-add-ons)
{% endhint %}

<figure><img src="/files/DMsxlbpYwDViGqPKXCYV" alt=""><figcaption></figcaption></figure>

```
window.dataLayer.push({
  event: 'add_to_cart',
	ecommerce: {
	  currency: string;
	  items: [
  	  {
        /** Product ID */
        item_id: string;
        /** Product Name */
        item_name: string;
        /** Product Brand */
        item_brand?: string;
        /** Store Id */
        location_id: string;
      }
    ]
    /** The monetary value of the event. */
	  value: number;
	}
});

window.dataLayer.push({
  event: 'view_item',
	ecommerce: {
	  currency: string;
	  items: [
  	  {
        /** Product ID */
        item_id: string;
        /** Product Name */
        item_name: string;
        /** Product Brand */
        item_brand?: string;
        /** Store Id */
        location_id: string;
      }
    ]
	  value: number;
	}
});

// Additional events outside of the purchase funnel ⬇️
window.dataLayer.push({
  event: 'customer_rating',
  rating: number,
});

window.dataLayer.push({
  event: 'login',
  method: string,
});

window.dataLayer.push({
  event: 'sign_up',
  method: string,
});

window.dataLayer.push({
  event: 'tap_header',
  element: string,
});

window.dataLayer.push({
  event: 'tap_menu',
  menu_option_selected: string,
});

window.dataLayer.push({
  event: 'set_store',
});
```

## Checkout Events

```
window.dataLayer.push({
  event: 'begin_checkout',
	ecommerce: {
	  currency: string;
	  items: [
  	  {
        /** Product ID */
        item_id: string;
        /** Product Name */
        item_name: string;
        /** Product Brand */
        item_brand?: string;
        /** Item quantity */
        quantity: number;
        /** Store Id */
        location_id: string;
      }
    ]
    /** The monetary value of the event. */
	  value: number;
	}
});

window.dataLayer.push({
  event: 'add_to_cart',
	ecommerce: {
	  currency: string;
	  items: [
  	  {
        /** Product ID */
        item_id: string;
        /** Product Name */
        item_name: string;
        /** Product Brand */
        item_brand?: string;
        /** Store Id */
        location_id: string;
      }
    ]
    /** The monetary value of the event. */
	  value: number;
	}
});

window.dataLayer.push({
  event: 'change_cart_item_count',
  productId: string,
  count: number,
  priceId: string,
});

window.dataLayer.push({
  event: 'remove_from_cart',
  ecommerce: {
    items: [
      {
        /** Product ID */
        item_id: string;
      }
    ]
  }
});

window.dataLayer.push({
  event: 'purchase',
  ecommerce: {
    transaction_id: string;
    currency: string;
	  items: [
  	  {
        /** Product ID */
        item_id: string;
        /** Product Name */
        item_name: string;
        /** Product Brand */
        item_brand?: string;
        /** Store Id */
        location_id: string;
      }
    ]
    /** The monetary value of the event. */
	  value: number;
  }
});
```
