Adding Google Tracking to your web site

About

UltraCart has the ability to automatically inject Google Analytics tracking code into your catalog and checkout screen branding. 

The following tutorial will walk you through configuring your Google Analytics account information within your UltraCart account.

The configuration fields for Google Analytics are found in your Screen Branding configuration area.  This is also the same place for other supported and third party conversion and tracking configuration. 


The following shows you where to add Google tracking for your storefront.

  1. Within Storefronts click on Conversion Tracking.



  2. Within Conversion Tracking you will see a tab at the top of the section for Google.




  3. As you can see this section is broken up into 4 sub-sections: Adwords, Affiliate Network, Analytics, and Trusted Stores.
    Simply configure your account information into the desired sections and click Save.


Tracking Types

There are multiple tracking types supported by UltraCart. The table below describes the various types, the script Google uses, and whether they support asynchronous loading:

Domain Override

By default the system is using secure.ultracart.com in 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. 

Cross Domain

If the integration is a checkout only and you do not have a SSL certificate applied to the storefornt checkout, then you'll configure the Cross Domain field with the domain (or domains) associated with the domain of the front end website where the customer will initate the checkout. The domain is entered without the http/https prefixes and without a subdomain.

(enter a comma separated list of domains here. Do not add any spaces.)
Example: mydomain.com,anotherdomain.com

Google Tag Manager

To configure Google Tag Manager:

Install a container in your content. Near the top of the window, find your container ID, formatted as "GTM-XXXXXX".
Click your container ID to launch the Install Tag Manager box.
Copy and paste the code snippets into your website as instructed, or download and install the appropriate mobile SDK.
Setup and installation - Tag Manager Help - Google Help

https://support.google.com/tagmanager/answer/6103696?hl=en


Testing

Try using this chrome plugin for testing the google tag manager:

https://get.google.com/tagassistant/

Tracking on External Websites (with Google Tag Manager)

The way Google Analytics loads scripts, it will not replicate the data tags.  To solve this problem we'll use a URL syntax instead of data attributes.  For example if our merchant id is SAMPL, our StoreFront is sampl.ultracartstore.com and our website is www.mysamplesite.com, then we connect the two by placing the following tracking script into the Google Tag Manager container for the www.mysamplesite.com website:

<script async defer src="https://d9i5ve8f04qxt.cloudfront.net/UC/62/uca/0.1.0/js/collect.js?mid=SAMPL&channel=sampl.ultracartstore.com"></script>

Just change the mid and channel to match your UltraCart account.

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.

Frequently Asked Questions

Q: I have Google Analytics configured and it's working fine for order placed from the website, but it's not being triggered for my auto orders?

A: The Google Analytic script is fired off based on cookies in the customer browser during the checkout. Since auto orders are generated without the additional involvement from the customer's browser, the GA script is not fired.

The following message from one of our merchants describes an *unofficial* (not directly supported by UltraCart basic support, troubleshooting only available through paid support $100/hr after review by Pro Service department) workaround that they have implemented to triggered the GA script using the XML Postback:

For the latest and greatest code, please visit this github site:

https://github.com/ryanjkelly/xml2ga

Ryan has made numerous improvements since the initial development which is listed below.



"Yes, I have been successfully tracking UC sales and refunds for the past few weeks through XML postback. I don't have a "template" I can send you, but this (link below) PHP code
will pretty much work out of the box if you just place your Google Analytics account ID in it. Note: the Google Analytics account must be the newer (Universal Analytics) type or else this won't work.

https://snipt.net/raw/72a876575e01ca300f34bd67fa26e0a3/?nice

Refunds are recorded into GA with "ref-" appended to the transaction ID so that you can then separate them easily in reports. I also plan to append "auto-" to auto orders to separate them in reports as well but haven't done that yet.

A few things to note when implementing this. Make sure the time zone in the Google Analytics property matches UltraCart's server time zone, which I think is EST. Also, merchants that get sales 24/7 will notice that daily revenue from GA and UC sometimes won't match up. This is because, for example, if a customer orders something from UC at 11:57pm, the order may not get recorded into GA until 12:02am, which it is then the following day."