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

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.

We respect the user's cookie preferences using google consent mode 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.

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.

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).

Last updated