How to add Google Ads Code To Shopify

Getting your new Shopify store setup is exciting and getting your Google Ads setup properly is critical to start collecting valuable data used in targeting customers with paid Ads. I'm going to show you how to set up your Google G-Tag Code, plus the event tracking to report on E-Commerce transactional data.

This means sending the order information back to Google Ads so your reporting can reflect properly a "Conversion" while utilizing E-Commerce order data reporting. Below I have provided detailed instructions to add this code to your Shopify store. If you want help from Pelican Commerce to handle this for you then reach out to us anytime!

Generate Google G-Tag & Event Tracking Code

Step 1: Login to Google Ads and click on "Tools & Settings".

Google Ad Conversion Setup Shopify 1

Step 2: In the "Measurement" area click on "Conversions".

Google Ad Conversion Setup Shopify 2

Step 3: Click on the "+" icon in the upper left-hand corner.

google ads code to shopify 1

Step 4: Select "Website" option.

google ads code to shopify 2

Step 5: Fill in the following information in the boxes: Category select "Purchase". Conversion name "Use any name you want". Value "Use different values for each conversion". Count "Every".

Step 6: In the four dropdown options, leave the default values (unless you need to change for a particular campaign).

Step 7: Click "Create and Continue" button.

google ads code to shopify 3

Step 8: Click "Install the tag yourself".

google ads code to shopify 4

Step 9: Keep the default selected options on this page as-is. You will see your Google G-Tag Code first. This will be used to Copy-paste into your Shopify theme.liquid file in the "Head" area. (see below for how to add to Shopify theme).

Step 10: The second code is your event tracking code. Copy this code and add it into the Shopify Admin > Settings > Checkout > Order Processing (Area) "Additional scripts" area (see below for. how to add to your Shopify settings).

Step 5

Now that you're at this point, you've accomplished getting Google to provide you with the one time G-Tag code to add to your theme. This is only ever added one time and is spread across all pages to track the overall movement of traffic sent from Google Ads to your website.

The second code you generated was an event tracking conversion code. This is to track when someone makes a purchase, at which time Shopify sends back the dynamic transactional order data to Google so you can report the value of the orders placed against how much you spent to generate that revenue. This code will be added to your Shopify checkout settings. This is also a one time code to add to Shopify.

Next I'm going to show you how to add this code into your Shopify store.

Adding The Code To Shopify

Step 11: Log in to your Shopify admin and head on over to the Online Stores area and click on "Themes."

shopify google code 1

Step 12: On the right-hand side, you will see in the published theme area, a drop-down called "Actions," click this button and select "Edit Code."

shopify google code 2

Step 13: On the left-hand side, you'll see a section called "Layout," inside this section, click "theme.liquid."

Step 14: The code file will appear to the right-hand side. Look for "<head>" and paste the G-Tag code under it.

shopify google code 3

Step 15: In the upper-right hand corner click the "Save" button.

Add E-Commerce Dynamic Code

Step 16: Head over to the lower left-hand corner of your Shopify admin and click on "Settings."

Step 17:. Click on "Checkout".

shopify google code 4

Step 18: Scroll down to the "Order Processing" section and located the "Additional Scripts" area.

Step 19: In the additional scripts box, paste in the Google event tracking code.

To prevent a customer from refreshing a page and triggering a "Conversion," you'll need to paste the following code before and after the event tracking code (see example below).

Above The Code

{% if first_time_accessed %}

Below The Code

{% endif %}
shopify google code 5

Step 20: Now, to make the code dynamic by adding in Shopify Liquid Objects, you'll need to modify the event tracking code. Replace the entire section that has "Value," "Currency," and "Transaction ID" with the following code.

 'value': {{ checkout.subtotal_price | money_without_currency }},
 'currency': '{{ shop.currency }}',
 'transaction_id': '{{ order_number  }}'

Step 21: Click the "Save" button in the upper right-hand corner.

What Happens Next?

This is a set it and forget it dynamic code, and it will start tracking each user on the site. When a customer makes a purchase, it will fire that data back to Google, and that transactional data will reflect in your Google Ads reports. This is especially useful to see how much you're spending and how much revenue was generated for that Ad spend.

Additional "Value" Reporting Option

There is an additional option for the transaction amount reported from Shopify to Google Ads if you want to include subtotal, tax, and shipping in the total transaction amount.

  1. In the transaction order "Value" in the code above, your reporting will show the subtotal amount for the purchase made. IF you want to include "Tax" and "Shipping" fees in the total transaction value, then replace the entire "Value" line with the following code.
'value': {{ checkout.total_price | money_without_currency }},

Need Help Adding Google Code To Shopify?

Pelican Commerce is a full-service agency, and we help E-Commerce businesses set up their Google Shopping feeds, Google Ads account, and all the tracking code to be sure everything is connected and running smoothly. Reach out to us today if you need help getting this setup on your Shopify store.

Thank you for visiting Pelican Commerce. We're a full-service E-Commerce agency servicing small business owners around the world. Located in Windermere, Florida USA, we specialize in website migrations to Shopify and bulk product uploading, data crawling, and helping clients get fully set up online.

Want us to take care of it?

Blog Pages
COPYRIGHT © 2020  |  ALL RIGHTS RESERVED
arrow-right linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram