Configuring Google Analytics
Configuring Google Analytics
UltraCart has the ability to automatically inject Google Analytics (GA4) tracking code into your StoreFront.
The following tutorial will walk you through configuring your Google Analytics account information within your UltraCart account. First navigate to:
Now scroll down to the Supported section. This section contains all of the different tracking systems that UltraCart has built in support for.
In this list you will find "Analytics" as shown below. For the tracking type select GA4. As of July 1, 2023 all other Google Analytics tracking types beside GA4 have been discontinued by Google.
Account Number
Enter the GA4 measurement ID in BOTH the "Account Number - Default" and "GA4 Measurement ID" field. This value should look like G-**************.
Obtaining your GA4 Measurement ID
- In Admin, make sure that you have the desired account and property selected.
- In the Property column, click Data Streams, then click your web data stream. Your “G-” Measurement ID appears in the upper right portion of the panel.
Pricing Tiers
If you have pricing tiers configured on your account for wholesale customers then you can track them on a separate Google Analytics account if you would like. There will be an additional row in the configuration for each pricing tier on your store. If you leave these blank then UltraCart will use the default UA- account when tracking the customer even if they have a pricing tier.
Domain Override
By default the system is using MerchantID.ultracartstore.com at the host to the checkout then the GA tracking is set to use that host. If you have a custom SSL then secure.yourdomain.com is passed to the tracking script as .yourdomain.com. This field will provide advanced user the ability to override this on the Google analytics tracking script.
Pro Tip - Use Custom SSL
Given that cookies are used to track the checkout progress, it's best if you use a custom SSL so that your checkout and website are on the same root domain.
So for example you would have:
www.yourdomain.com -> MID.yourdomain.com
Then in your GTM or GA tracking you would set the allow domain to ".yourdomain.com". This will allow the GA tracking cookies to be visible on both domains.
If you have two different root domains then on your www.yourdomain.com you're going to have to implement some of the techniques documented on this page.
https://support.google.com/analytics/answer/1034342?hl=en
Cross Domains
If you need cross domain tracking in Google Analytics, enter a comma separated list of domains here. Do not add any spaces.
Example: mydomain.com,another.domain.com
Opt Into
Use the "Opt in to" setting to assign (Drop-down list: Statistics / Preferences / Marketing) required for (Drop-down list: All Customers / EEA Customers / Non-US Customers)
GA4 API Secret
If you want UltraCart to use the Google Measurement API to report offline conversions (such as when the upsell closer finalizes an order) or auto order rebills, configure the GA4 API Secret field.
Obtaining your GA4 API Secret
- First, go to your Google Analytics Admin > Data Streams and open your chosen stream:
- Scroll down to the Additional Settings tab and click on Measurement Protocol API secrets; then click Create:
- You will have to create a nickname for your new API secret; we recommend naming this GA4-key. Click Create
- You will need to copy the Secret value provided into the corresponding UltraCart configuration field.
This value is confidential and should only be configured in your UltraCart account. - All done!
GA4 Server Container URL
If you are running your own GA4 server side tracking instance, configure the URL here. UltraCart will pass this to the gtag config as an option. If you don't know what this means, do not configure anything.
GA4 User ID (Provide UC Analytics ID as User ID)
Select this checkbox if you to provide UC Analytics ID as the user ID.
Supported GA4 Events for all Themes
Event | What triggers the event |
---|---|
page_view | When a page is viewed in the StoreFront or checkout |
purchase | When a purchase occurs and the customer views the receipt. If the customer abandons the upsell sequence and the order is generated by the upsell closer, then those purchase events are reported through the Google Measurement protocol if the GA4 API key is configured. |
Supported GA4 Events in StoreFront Visual Builder Themes
Event | What triggers the event |
---|---|
add_payment_info | When the credit card number field is populated during the checkout. |
add_shipping_info | When a shipping method is selected during the checkout |
add_to_cart | When a customer adds an item to the cart |
add_to_wishlist | When a customer adds an item to their wishlist |
begin_checkout | When the customer begins filling out inputs in the checkout form or interacts with an alternate payment method such as PayPal, Apple Pay or Google Pay |
login | When the customer logs into their customer profile during the checkout or in the MyAccount area. |
remove_from_cart | When the customer removes an item from their cart by setting the quantity to zero or clicking a remove button. |
search | When the customer enters a search phrase |
select_promotion | When the customer accepts an upsell after offer. |
signup | When the customer registers for a profile during the checkout or through the MyAccount signup form. |
view_cart | When the customer views the item's in their cart during the checkout |
view_item | When the customer views a specific item within a StoreFornt |
view_item_list | When the customer views a list of items. This can include related items in the checkout, a group of items, search results, etc. |
view_promotion | When the customer views an upsell after offer. |
Non-Visual Builder Themes
Non-Visual Builder themes do not have built in support for the events above. Those themes include: Mr Teas, Craft, Natural, Woodland, Gridzy, Fashion and Coffee.
Supported GA4 Events when the GA4 API is Configured
Event | What triggers the event |
---|---|
earn_virtual_currency | When a customer earns a cashback award through the Loyalty Program |
purchase | When a purchase occurs offline (i.e the csutomer does not see the receipt because the order is created by the upsell closer or a subscription rebill) |
refund | When a refund occurs on an order. Since this is an offline operation, it can only be reported through the GA4 API. |
spend_virtual_currency | When a customer redeems a cashback award through the Loyalty Program |
Frequently Asked Questions
Q: If I use the GA4 measurement API, will the events associate with the GA4 session?
A: Yes, UltraCart captures the session ID out of the _ga_<container id> cookie on the browser and uses that value when passing Google Measurement events. This can be observed in the integration logs for the Google Measurement integration.
Q: Can I track a GA4 session across multiple domains like www.mydomain.com and secure.mydomain.com
A: Yes, make sure that you configure GA4 for cross domain functionality. Also we recommend deploying UltraCart Analytics to your external site so that UltraCart can observe the entire session end-to-end and collect necessary identifiers to drive the Google Measurement API.