> For the complete documentation index, see [llms.txt](https://docs.pakk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pakk.io/websites/google-services/analytics.md).

# Analytics

The most basic and simplest setup. Google Analytics is the canonical site-analytics service. It gives you an overview of who’s been on your site, where they have come from and where they go afterwards. Even if you don’t spend a lot of time trawling the vast amount of data it spits out, it’s still worth setting it up just to get a picture of how much traffic your site is getting.

Over the years (like most of Google’s services), setup has become complicated. There’s a hierarchy of concepts like Account > Property > View that you need to get your head around, but once you’ve set it up and injected your tracking ID into your site, there’s nothing more you need to do.

Pakk site owners just need to copy the tracking ID from Analytics and paste it into the ‘Google Analytics ID’ field in Website > Setup. Remember to do this separately for each of your Pakk sites.

### Technical notes on integration <a href="#technical-notes-on-integration" id="technical-notes-on-integration"></a>

When setting the tracking-id, as the Google Analytics Id in the admin panel, you have the option to set this to debug-mode. This allows you to monitor events in your [google analytics account in debug view](https://support.google.com/analytics/answer/7201382?hl=en).

We respect the user's cookie preferences using [google consent mode](https://support.google.com/analytics/answer/10000067?hl=en\&sjid=6523890064660737285-EU) to set each of 'ad\_storage', 'analytics\_storage', 'ad\_user\_data', and 'ad\_personalization' appropriately.

We set url\_passthrough to true, this allows you to track client and session ids from your ads via the URL, [see here](https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced#passthroughs).

We send the following events:

* purchase
* add\_to\_cart
* remove\_from\_cart
* add\_to\_wishlist
* view\_cart
* begin\_checkout

With all of these events we send the following parameters:

* currency
* value - inc. VAT
* items - (item\_id (sku), item\_name (sell\_name), price (exVAT for the item), quantity) - For the actions that specifically act on an item (add\_to\_cart, remove\_from\_cart, add\_to\_wishlist) the is just the singleton list of the item being acted upon. For the other events (purchase, view\_cart, begin\_checkout) this is the items in the cart at the time of the event.

In addition for the 'purchase' event we include

* transaction\_id
* The cost of shipping (ex. VAT) associated with the purchase.

## UTM Parameters

UTM parameters, including the gclid (Google Click Identifier), are read by the commerce app upon loading. These are stored in the app's memory, and maintained as the user clicks around the app. When a google analytics event is sent, together with the parameters described above, we send the UTM parameters as well.&#x20;

The UTM parameters are maintained in the URL, such that if the user leaves the page and returns based on the URL when leaving, then the UTM parameters are preserved. In particular if the payment method has an "off checkout" method, where the user is directed to a separate website to complete payment and then returned, the `purchase` event will be registered with the UTM parameters.

When the customer completes a payment and is sent to the order confirmation page, at that point, the UTM parameters are dropped from the URL (though still stored in the app's memory).

\ <br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.pakk.io/websites/google-services/analytics.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
