# Analytics and conversion tracking with Customer Events

Source: https://support.storeconnect.com/articles/tracking-customer-activity-with-events · Last modified 21 August 2026

StoreConnect fires Customer Events when shoppers take actions on your store. You can read these events in Liquid and use them to send analytics and conversion tracking calls — for example, forwarding a `purchase` event to Google Analytics 4 or the Meta (Facebook) Pixel with the real order value. This guide covers the available events, how to read them, and how to connect them to your tracking providers.

## Overview

A Customer Event represents an action a customer performs on the store. Liquid exposes events through the global `current_events` collection, where each entry is a [CustomerEvent](customer-event-liquid-object-reference) object with a `type` and optional `event_data`.

To read an event's data you wrap it in the [`process_event`](process-event-tag-reference) block tag. The tag loads the event's properties — and, for a purchase, the full `order` object — into scope for the duration of the block, then marks the event as handled so it fires only once.

You place this Liquid in a Content Block in your store's **Head Content**, alongside the base tracking snippet for your analytics provider.

## Available events

| `type` | When it fires | Data available inside the block |
|--------|---------------|---------------------------------|
| `cart.add` | A customer adds a product to their cart | none |
| `purchase` | A customer completes checkout and payment succeeds | the `order` object |

The `purchase` event exposes the full [Order](order-liquid-object-reference) object as `order`, so you can send accurate transaction values.

## Before you begin

- Install the base tracking snippet for your provider. See [Integrate Google Analytics in your store](add-your-google-analytics-code) and [Add your Facebook Pixel code](add-your-facebook-pixel-code).
- You edit the **Head Content** through a Content Block in the StoreConnect Config app. See [Content management](content-management).

## How to read and handle events

Loop over `current_events`, wrap each one in `{% process_event %}`, and branch on `event.type`:


```liquid

{% for event in current_events %}
  {% process_event event %}
    {% if event.type == "purchase" %}
      <!-- order is available here -->
    {% elsif event.type == "cart.add" %}
      <!-- cart add -->
    {% endif %}
  {% endprocess_event %}
{% endfor %}
```


:::warning
The `type`, `event_data`, and `order` values are only available **inside** the `{% process_event %}...{% endprocess_event %}` block. Reading `current_events` without the `process_event` tag returns no usable data, and the event will not be marked as handled.
:::

Each event is handled exactly once. When the `process_event` block finishes, the event is marked as processed and will not appear in `current_events` on the next page load — so a purchase is not counted twice if the customer refreshes the confirmation page.

## Example — Google Analytics 4

Add this to the same Content Block that holds your GA4 base snippet (`gtag`), in **Head Content**:


```liquid

{% for event in current_events %}
  {% process_event event %}
    {% if event.type == "purchase" %}
      <script>
        gtag('event', 'purchase', {
          transaction_id: "{{ order.reference }}",
          value: {{ order.total }},
          currency: "{{ order.currency_code }}",
          tax: {{ order.total_tax }},
          shipping: {{ order.total_shipping }}
        });
      </script>
    {% elsif event.type == "cart.add" %}
      <script>
        gtag('event', 'add_to_cart');
      </script>
    {% endif %}
  {% endprocess_event %}
{% endfor %}
```


## Example — Meta (Facebook) Pixel

Add this to the same Content Block that holds your Pixel base code (`fbq`):


```liquid

{% for event in current_events %}
  {% process_event event %}
    {% if event.type == "purchase" %}
      <script>
        fbq('track', 'Purchase', {
          value: {{ order.total }},
          currency: "{{ order.currency_code }}"
        });
      </script>
    {% elsif event.type == "cart.add" %}
      <script>
        fbq('track', 'AddToCart');
      </script>
    {% endif %}
  {% endprocess_event %}
{% endfor %}
```


## Order values for the purchase event

Inside a `purchase` block, these properties are available on `order`:

| Property | Description |
|----------|-------------|
| `order.reference` | The order reference number — use as the transaction ID |
| `order.order_number` | The human-readable order number |
| `order.total` | Order total, including tax |
| `order.sub_total` | Subtotal of order items, including exclusive taxes |
| `order.total_tax` | Total tax for the order |
| `order.total_shipping` | Total shipping charge |
| `order.currency_code` | The currency used for the order |

See the [Order Liquid Object Reference](order-liquid-object-reference) for the full list of available properties.

## Reference

- [CustomerEvent - Liquid Object Reference](customer-event-liquid-object-reference)
- [Process Event - Liquid Tag Reference](process-event-tag-reference)
- [Global - Liquid Object Reference](global-liquid-object-reference) — `current_events`
- [Order - Liquid Object Reference](order-liquid-object-reference)

---

## Follow StoreConnect

- [Email Newsletter](https://getstoreconnect.com/c/lp-newsletter)
- [LinkedIn Newsletter](https://www.linkedin.com/build-relation/newsletter-follow?entityUrn=7444956928444862464)
- [YouTube](https://www.youtube.com/channel/UCngKdP2x8l1wcbAKW3tvU8g)
- [LinkedIn](https://www.linkedin.com/company/storeconnect)
- [X / Twitter](https://x.com/storeconnecthq)

## Popular Links

- [Partners](https://getstoreconnect.com/partners)
- [News](https://getstoreconnect.com/articles/news)
- [Events](https://getstoreconnect.com/articles/events)
- [Feature Comparison](https://getstoreconnect.com/how-we-compare)
- [Download a free trial](https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FMkeKUAT)
- [Book a Demo](https://getstoreconnect.com/contact)

## Documentation

- [Help documentation](https://support.storeconnect.com/help-documentation)
- [AI agents](https://support.storeconnect.com/ai)
- [Videos & tutorials](https://support.storeconnect.com/videos-tutorials)
- [Developer reference](https://support.storeconnect.com/developer-reference)
- [Release notes](https://support.storeconnect.com/release-notes)
- [Troubleshooting](https://support.storeconnect.com/troubleshooting)
- [Trust Center](https://trust.getstoreconnect.com/)
- [Status Page](https://status.storeconnect.com/)

## Contact

- info@getstoreconnect.com
- US +1 415 745 3230
- AUS +61 2 8365 2308

100 S Ashley Dr, Suite 600-2461
Tampa FL 33602-600 USA

Level 22, Sydney Place
180 George Street
Sydney, NSW, 2000, AUS

---

StoreConnect Support — https://support.storeconnect.com/articles/tracking-customer-activity-with-events