Setting Up Google Analytics
Google Analytics is a free analytics tool that helps you track visitors and conversions on your store. To set up Google Analytics, you will need to create and verify your Google account.
We've updated our Google Analytics integration to support Enhanced Ecommerce and Site Search. We've also made the setup easier and code free — all you need is your Google Analytics property ID.
Those using the Cornerstone theme will not need to make any changes and can start using the integration right away. If you are using a Stencil theme other than Cornerstone, you will need to add Data Tags to your theme. If you are using a Blueprint theme, you will need to add Data Tags to your theme and check the Enable Data Tags checkbox during setup.
Recommended Setup
These steps will show you how to set up Google Analytics to take advantage of our new integration and how to connect it with your store.
Requirements
- Store must be using the Cornerstone theme (2.6.0 or later) or a customized theme with data tags.
- Store must be using Optimized One-Page Checkout.
- Checkout Labeling in Google Analytics must match your store's checkout steps. See Setting up Google Analytics.
Creating the Tracking ID
1. Sign into or create your Google Analytics account. Then click Admin.
2. Under Account, click Create Account.
3. Complete the form, then click Get Tracking ID.
4. Accept the Google Analytics Terms of Service Agreement and copy the tracking ID. Note that you will not need to copy any code. It will look something like this:
Setting up Google Analytics
Enhanced Ecommerce
1. After creating the tracking ID, click the Return to Admin Home Arrow to go back to the Admin area.
2. In the Admin area, go to View › Ecommerce Settings.
3. Under Enable Ecommerce, toggle the status to ON. Next, toggle Enable Enhanced Ecommerce Reporting to ON.
4. Under Checkout Labeling, add funnel steps that match your store's checkout steps, then Save your changes. Your funnel steps should look like this:
Site Search
Site Search is a report that can provide you with important insights on how shoppers interact with your store's search function. The data it contains can help answer the following questions:
- How frequently do shoppers use my search box?
- Where do shoppers begin searches and what do they find?
- What are shoppers looking for?
1. In your Google Analytics account, go to Admin › View Settings.
2. Under Site Search Settings, toggle the status to ON. In the Query parameter field, enter the words: search_query and Save your changes.
ENABLING GOOGLE ANALYTICS TRACKING
Note: If you are switching from the manual process, be sure to move any code you have in the Tracking Code box to the Script Manager before installing your tracking ID.
Once you have successfully generated the tracking ID, it will need to be installed in your BigCommerce store.
1. In the BigCommerce control panel, go to Advanced Settings › Web Analytics.
2. Check the box next to Google Analytics, then click Save.
3. Click the Google Analytics tab that appears at the top of the page.
4. Select Set up Google Analytics with Ecommerce using Property ID (Recommended), paste your tracking ID and Save your changes.
If you are using a Blueprint theme, you will need to check Enable Data Tags. This checkbox is only visible to those using a Blueprint theme.
Manual Setup
These steps will show you how to set up Google Analytics for Ecommerce Tracking and how to implement the code into your store manually. There are a few notes to be aware before continuing.
- This implementation does not support Enchanced Ecommerce.
- This implementation method uses Google's analytics.js and not Global Site Tag (gtag.js).
- You must have a dedicated SSL as this feature does not work with the shared .mybigcommerce.com SSL certificate.
- If using the manual setup, Enable DataTags should not be enabled. See Installing the Tracking Code.
Setting up Google Analytics
Ecommerce Tracking
1. In your Google Analytics account, go to Admin › View › Ecommerce Settings.
2. Under Enable Ecommerce, toggle the status to ON and leave Enhanced Ecommerce Settings set to OFF. Save your changes.
3. Copy the following tracking code. Be sure to copy the entire code, beginning with <script> and ending with </script>.
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-xxxxxxxx-x', 'yourdomain.com');
ga('send', 'pageview');
ga('require', 'ecommerce', 'ecommerce.js');
function trackEcommerce() {
this._addTrans = addTrans;
this._addItem = addItems;
this._trackTrans = trackTrans;
}
function addTrans(orderID,store,total,tax,shipping,city,state,country) {
ga('ecommerce:addTransaction', {
'id': orderID,
'affiliation': store,
'revenue': total,
'tax': tax,
'shipping': shipping,
'city': city,
'state': state,
'country': country
});
}
function addItems(orderID,sku,product,variation,price,qty) {
ga('ecommerce:addItem', {
'id': orderID,
'sku': sku,
'name': product,
'category': variation,
'price': price,
'quantity': qty
});
}
function trackTrans() {
ga('ecommerce:send');
}
var pageTracker = new trackEcommerce();
</script>
4. Continue to Installing the Tracking Code.
Installing the Tracking Code
Once you have successfully generated the tracking code, it will need to be installed in your BigCommerce store.
1. In the BigCommerce control panel, go to Advanced Settings › Web Analytics.
2. Check the box next to Google Analytics, then Save.
3. Click the Google Analytics tab that appears at the top of the page.
4. Paste the tracking code into the Tracking Code field. Replace UA-xxxxxxxx-x and yourdomain.com with your Google Tracking Number and your store's domain. If you are using a Blueprint theme, leave Enable DataTag disabled.
5. Save your changes.
Excluding Referrals From Hosted Payment Gateways
To avoid transactions made through a hosted gateway such as PayPal appearing as referrals through Google Analytics, you will need to add the payment gateway to your Referral Exclusion List.
1. In your Google Analytics account, go to Admin › Property › Tracking Info › Referral Exclusion List.
2. Click Add Referral Exclusion.
3. Enter the domain of your payment gateway (e.g. paypal.com) in the Domain field, then click Create to save your changes.