Conversion tracking configuration for Google Analytics

Highlighted
New Member
7 0 0

I need to set up GA conversion tracking. At https://support.google.com/analytics/answer/1009612?hl=en, Google identifies that the tracking code needs to be implemented per the "Developer Guide" for your specific environment. Is there a Developer Guide for Shopify? Can someone help guide me on how to get this implemented? Thanks.

0 Likes
Highlighted
Tourist
88 0 2

Hi Gina,

 

To set up Google Analystics on Shopify, all you have to do is go to 'settings' in Shopify admin, scroll down and you will see instructions there to add the GA code :)

Hope this helped!

 

Mally - Flagship Design

Shopify design, SEO and online marketing - www.flagship-design.com
0 Likes
Highlighted
New Member
7 0 0

That adds the GA code to all of the pages so you can track the visitors. There is a different code and implementation required to track the sales on the site. That's where I need help. I want to track the actual conversions, not just the visitors. Thanks.

0 Likes
Highlighted
Tourist
88 0 2

Oh i get you, to implement that code, go to settings - checkout - and then about halfway down you'll see a section called Additional content & scripts you should be able to add your code there.

 

Mally - Flagship Design

Shopify design, SEO and online marketing - www.flagship-design.com
0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
5711 0 139

Hi Gina, please follow the instructions in Shopify Docs.

Here for adwords: http://docs.shopify.com/manual/your-store/2-dashboard/7-google-adwords

Here for regular tracking: http://wiki.shopify.com/Conversion_Tracking

http://shopifyplus.com ::: http://twitter.com/bacchus
1 Like
Highlighted
New Member
1 0 2

Here is the Google Analytics Ecommerce Conversion Tracking code I use for my Shopify sites:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-########-1']);
  _gaq.push(['_trackPageview']);
  _gaq.push(['_addTrans',
    '{{ order_number }}',           // transaction ID - required
    '{{ shop.name }}',  // affiliation or store name
    '{{ subtotal_price | money_without_currency }}',          // total - required
    '{{ tax_price | money_without_currency }}',           // tax
    '{{ shipping_price | money_without_currency }}',              // shipping
  ]);

   // add item might be called for every item in the shopping cart
   // where your ecommerce engine loops through each item in the cart and
   // prints out _addItem for each

{% for line_item in line_items %}

  _gaq.push(['_addItem',
    '{{ order_number }}',           // transaction ID - required
    '{{ line_item.sku }}',           // SKU/code - required
    '{{ line_item.title }}',        // product name
    '{{ line_item.price | money_without_currency }}',          // unit price - required
    '{{ line_item.quantity }}'               // quantity - required
  ]);

{% endfor %}

  _gaq.push(['_trackTrans']); //submits transaction to the Analytics servers

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl'; : 'http://www';) + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

Just replace the GA account number (UA-########-1) with your own and place this in the "Additional content & scripts" section on the "Checkout" page within "Settings".

2 Likes
Highlighted
New Member
2 0 0

Hi Jamie, Is there a clear easy to follow direction anywhere on how to do ecommerce tracking with Google Analytics? I have not been able to find a clear answer and script. The direction you posted is for pixel tracking. What about GA Ecommerce tracking?

thanks

0 Likes
Highlighted
New Member
1 0 0

Kevin,

I've implemented that code you posted.  Additionally, I want to make sure I'm tracking conversions on my thank you page correctly.  Where in Google Analytics do you get this code?  

Using this source as a reference, Google says:

 

 https://support.google.com/analytics/answer/1033158?hl=en

 

The Goal page is not tagged with tracking code
If the Goal page is not tagged with tracking code, Google Analytics does not track this page, and as a result does not track Goals. You should also make sure that you've installed the correct tracking code on your pages since the code is specific to each account property. To find the tracking code, click Admin at the top of any Analytics page, then select the account and property. Under property, click Tracking Code. The status appears at the top of the page.

 

Thoughts?

0 Likes
Excursionist
44 0 10

Hi. I too am struggling to get GA ecommerce tracking working on my Shopify site.  I am using GA "classic" (as opposed to "Universal Analytics") because Universal Analytics does not yet support ecommerce tracking (as of Mar 2014).  My code is very similar to Kevin's code (see below).  It should work fine but my ecommerce data does not show up in GA.  I'm thinking it is a cross-domain issue related to the fact that the "thank you" page that the user gets after they make a purchase comes from a different domain than your normal web site domain.  I am using the Stripe payment gateway, and my "Thank You" pages comes from checkout.shopify.com rather than my web site domain, which is what GA tracks.  I just changed one line of my GA tracking code to:

_gaq.push(['_setDomainName', 'checkout.shopify.com']);

to try to fix it, but I haven't had enough time yet to know if it works or not.

Here is my GA tracking code:

<!--
google analytics "classic" tracking code 
feeds google analytics account UA-XXXXXXXX-2
-->
<script type="text/javascript">

	var _gaq = _gaq || [];
	// var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js';;
	// _gaq.push(['_require', 'inpage_linkid', pluginUrl]);
	_gaq.push(['_setAccount', 'UA-XXXXXXXX-2']);
	_gaq.push(['_setDomainName', 'checkout.shopify.com']);
	_gaq.push(['_setAllowLinker', true]);
	_gaq.push(['_trackPageview']);
	_gaq.push(['_set', ‘currencyCode’, ‘USD’]);
  
	_gaq.push(['_addTrans',
		'{{ order_number }}',								// transaction ID - required
		'{{ shop_name }}',  								// affiliation or store name
		'{{ total_price | money_without_currency }}',		// total - required
		'{{ tax_price | money_without_currency }}',			// tax
		'{{ shipping_price | money_without_currency }}',	// shipping
		'{{ shipping_address.city }}',						// city
		'{{ shipping_address.province }}',					// state or province
		'{{ shipping_address.country }}'					// country
	]);

	{% for line_item in line_items %}
		_gaq.push(['_addItem',
			'{{ order_number }}',								// transaction ID - required
			'{{ line_item.sku }}',								// SKU/code - required
			'{{ line_item.title }}',							// product name
			'{{ line_item.id }}',				// category or variation
			'{{ line_item.price | money_without_currency }}',	// unit price - required
			'{{ line_item.quantity }}'							// quantity - required
		]);
	{% endfor %}

	_gaq.push(['_trackTrans']);		//submits transaction to the Analytics servers


  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://'; : 'http://';) + 'stats.g.doubleclick.net/dc.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  
</script>

 

0 Likes
Highlighted
Shopify Partner
52 0 7

Hi Lolo,

Have you tried using the standard analytics implementation under your myshopify.com admin section? i.e. going to shop-name.myshopify.com/admin/settings/general and then adding a generic analytics tracking code to the Google Analytics section? If so Shopify automatically handles the ecommerce tracking and cross domain tracking for traditional analytics - you just need to make sure that in your Google Analytics profile you have ecommerce switched on - i.e. go to admin -> view settings (for a profile) and enable ecommerce tracking. Even if you are manually adding scripts you will still need to ensure this has been enabled - otherwise GA doesn't seem to log ecommerce transactions...

Cheers,

Mike

A Positive10 Peep
1 Like