Ecommerce in Google Analytics has long been a must-have and the main tool for tracking the effectiveness of online marketing. In order to avoid mistakes in setting up e-commerce, you need to know and take into account many details. In most cases, they turn to specialists for this, but in order to be sure of the correct setting, you should read this article.
For online store owners or online marketers, e-commerce allows you to find out which advertising channel works best, where the ROI is higher, the average check is more expensive, the cost of attracting a lead or the cost of an already attracted client is lower, and much more.
But in connection with the installation of e-commerce, various kinds of problems arise. The most popular two are:
- business owners do not always want to transfer full access to the site to the Internet marketing agency, and they want the improvements to be done by their programmers. Only such “own programmers” in 90% cases do not know how to install e-commerce correctly and make various mistakes during the installation process.
- even if you have installed analytics from a seemingly versed specialist, not all data can be transferred correctly, since there are very few qualified experts in installing and configuring Google Analytics, and therefore not everyone “seemingly versed” is familiar with a large number of nuances and is able to save you from setup errors.
After placing an order
there is a confirmation page and GTM is installed
Be sure to remember that this code must be placed before Google Tag Manager code snippet so that the dataLayer object is already populated by the time the Google Analytics tag is activated.
Consider the variables that are used to pass data:
- transactionId* — unique transaction identifier
- transactionAffiliation - partner or store
- transactionTotal* — total transaction amount
- transactionTax - tax
- transactionShipping — shipping amount
- transactionProducts - list of products purchased in this transaction
- sku — product identifier (article)
- name* — product name
- category — product category
- price* — price per item
- quantity* — product quantity
All variables marked with * are mandatory.
Used by Universal Analytics without GTM
If for some reason you decide not to use Google Tag Manager on your site, then to send transactions to Google Analytics, you need to add the following code to the confirmation page:
The order form is submitted asynchronously and GTM is installed
The question arises, what to do when there is no confirmation page when placing an order? In this case, the data is sent to the server without reloading the page. In order for the transaction to still be included in the analytics, you must perform the following steps:
1. Fill dataLayer in the same way as shown above:
2. Add the following to the success ajax callback function:
The name of the event can be arbitrary. For its part, the analyst sets up e-commerce triggering exactly when the transaction event is fired.
Universal Analytics + AJAX
In the case where the checkout form is submitted without reloading the page and using only Universal Analytics, the action to add data is very close to what we did in the second paragraph. The only exception is that the line you need to add success callback to ajax.
Author: web-programmer of the StarMarketing agency of strategic Internet marketing Ekaterina Demyanchuk