How to Install Facebook, Google Ads, & Google Analytics on Your Shopify Store

May 12, 2020 | Advertising, eCommerce

You have your fancy new Shopify store ready to sell, sell, sell! Just don’t forget to track, track, track. What you don’t track, you can’t measure, and what you don’t measure, you can’t improve. Luckily, installing tracking for your Shopify store is super easy. As a Shopify Expert, a Google Certified Agency, and a Facebook Preferred Marketing Partner, we’re well versed in ensuring your eCommerce store’s tracking is up to our high standards.

Before you get started, do note that installing both Google Tag Manager (GTM) and installing Google Analytics via Shopify would cause double tracking in Analytics. GTM definitely has its place, but in this case, installing via Shopify is the superior, foolproof solution. If you think you may have started the process in the past, but never finished (we get it, life happens), you will want to check out the help article from Shopify here. It’ll prevent any unnecessary friction.  Let’s get tracking!

In the first screenshot below, you’ll see where to:

1. Input Analytics on your online store.

2. Add an additional Google Analytics script to require eCommerce tracking:

ga(‘require’, ‘ec’);

3. OPTIONAL – Add additional Google Analytics scripts to use the Linker (for if you’re dealing with two domains, such as www.website.com and shop.website.com):

ga(‘require’, ‘linker’);
ga(‘linker:autoLink’, [‘source.com’, ‘destination.com’]);

 4. Input the Facebook Pixel ID

Shopify Analytics via Google Adwords and Facebook Pixel

5. Next, click on “Themes” > “Actions” > “Edit code”

6. In the Layout called “theme.liquid” input the below code below the <head> tag and before the closing </head> tag. Make sure that the document doesn’t format the code apostrophe: ‘ with a stylized apostrophe: ‘ or code quote marks: ” with stylized quote marks: “”

You need to replace the red pieces of the code below ######### with your Conversion ID. If you need help finding this, Read how to find your Conversion ID.

<!-- Global site tag (gtag.js) - Google Ads: ######### -->

<script async src="https://www.googletagmanager.com/gtag/js?id=AW-#########"></script>

<script>

  window.dataLayer = window.dataLayer || [];

  function gtag(){dataLayer.push(arguments);}

  gtag('js', new Date()); 

  gtag('config', 'AW-#########');

</script>

<!-- END Global site tag -->

Shopify Themes

7. Go to Settings > Checkout

 

Shopify Checkout Settings

8. Scroll down to Order Processing

9. Add the AdWords Conversion Codes to the “Additional Scripts” section. You need to replace the highlighted pieces of the code with your Conversion ID and your Conversion Label. Pay very close attention to the highlighting, so as not to miss the slash “/” in between the two, but do not put a space “ ” in between them.

<!-- Global site tag (gtag.js) - Google Ads: ######### -->

<script async src=“https://www.googletagmanager.com/gtag/js?id=AW-#########/“></script>

<script>

window.dataLayer = window.dataLayer || [];

function gtag(){dataLayer.push(arguments);}

gtag('js', new Date());

gtag('config', AW-#########);

</script>




<!-- Event snippet for Sales conversion page -->

<script>

gtag('event', 'conversion', {

    'send_to': 'AW-#########/XXXXXXXXXXXXX',

    'value': {{ checkout.subtotal_price | money_without_currency | remove: ',' }},

    'currency': 'USD',

    'transaction_id': '{{ order_number }}'

});

</script>

Shopify Adwords Setup

That’s it. You’re ready to go! If you are new to Shopify or new to Google Analytics, check out Shopify’s handy eCommerce Beginner’s Guide on exactly what this tracking can do for you.

Let the Experts Do it For You

We solve these kinds of issues all the time for startups selling anywhere from $150k to $10M annually online. Need a Shopify Expert to take your selling to the next level? Contact Rainfactory today!