How to Set Up Google Ads Conversion Tracking on Shopify

Blog > Marketing > How to Set Up Google Ads Conversion Tracking on Shopify

You want to get your brand out there so more people will purchase your products. A great way to do that is to run pay-per-click ads, specifically on Google. It’s the most popular search engine, and you probably see targeted ads when you use Google, whether you realize it or not. That’s why it’s a good idea to run Google Ads for your ecommerce website.

You also know it’s important to keep track of data so you can measure and improve your marketing efforts, but you’re not quite sure how to go about it. That’s why we’ve put together this guide on how to set up Google Ads conversion tracking on Shopify.

Don’t Double Up

Before you follow the instructions below, you need to double check that you don’t already have conversion tracking events set up in your Google Ads account. If you are using Shopify’s Google & Youtube channel, then the tracking events are added during your account setup.

If you have this or another custom tracking event set up, you may accidentally be tracking the same information twice, leading to inaccurate data. That’s why you only want to set it up once, so you get the most accurate information possible.

Below, we detail two different ways you can set up the Google Ads conversion tracking on Shopify. You will not want to do both, for the reasons stated above—choose the one that makes the most sense for your business.

Option 1: Google Ads Setup

Before you follow these instructions, you’ll need to create a Google Ads account. That account will be used for creating and managing all aspects of your Google Ads campaign.

Step 1: Create a conversion action

1. Log into your Google Ads account.

2. Click on Tools and Settings.

3. Click on Conversions.

google ads navigation menu

4. Click the blue button that says “New Conversion Action.”

5. Click Website Conversions.

website conversion options in google ads

6. Click “+Add a conversion action manually.”

create conversion action manually in google ads

7. Set category as Purchase/Sale, and the conversion name should describe where the conversion is coming from (Shopify, in this case).

8. Set the conversion action to track unique values for each conversion by choosing “Use different values for each conversion.” In the case of online sales, this will count the total purchase price as the conversion value. 

manual conversion action menu in google ads

9. Then click Done.

You’ll be taken back to the New conversion action menu that looks like this:

new conversion action menu in google ads

Click save and continue.

Step 2: Install the Google tag

10. A new menu will appear. Click on the blue button that reads, “Set up.”

tag menu in google ads

11. A pop up menu titled “Set up a Google tag.” Choose the option “Install manually.” Copy the code in the box.

tag setup in google ads for manual installation

12. Open the back end of your Shopify store.

13. Open the Online Store section, and click on Themes.

14. Click on the ellipsis (…) and then click Edit code.

shopify editing theme in the back end of the website

15. Look on the left side of the screen for theme.liquid, and open it. Search the page until you find the head tag <head>. Paste the code directly after this tag. Click save.

heading code in the back end of shopify

16. In Shopify, go to the settings tab, and click checkout.

shopify settings checkout page

Scroll all the way down until you see Additional Scripts: Order Status Page. Paste the Google Tag code into this box. Click Save.

order page status in the back of shopify website

Step 3: Install the event snippet

17. Go back to Google Ads and locate the Event Snippet section under “Tag Setup.” Make sure “Page Load” is highlighted to ensure the tag fires every time a page loads, and copy the event snippet code in the box.

event tag code in google ads

18. Go back to Shopify where you still have the Additional Scripts: Order Status Page section open. Hit enter a few times and paste the event snippet code into the same Additional Scripts box.

event code in shopify

To prevent duplicate conversions, you will want to add the following code before and after the event snippet code. This triggers the conversion once per customer.

  1. On the line before the event snippet, paste {% if first_time_accessed %}
  2. On the line after the event snippet, paste {% endif %}.

19. The default transaction ID line is blank. You will need to replace ‘ ‘ with {{ order_number }} to prevent Google Ads from recording duplicate conversions.

20. Go back to Google Ads and click next. A new screen will appear and say “You’ve set up your Purchase (Shopify) conversion action.” 

Step 4: Create the conversion value dynamic

21. Go back to Shopify to the Additional Scripts: Order Status Page.

22. In this text box, locate the event snippet code you previously added in Step 3.

23. Find the line beginning with ‘value’: and replace it with one of the following snippets:

  1. Exclude taxes and shopping from the conversion amount with this snippet: 'value': {{ checkout.subtotal_price | divided_by: 100.0 }},
  2. Include taxes and shipping in the conversion amount with this snippet: 'value': {{ checkout.total_price | divided_by: 100.0 }},

24. Click Save.

You want to ensure all of the code is working properly. Navigate to your Google Ads account, and click on Conversion Actions. You may notice it will say unverified. Once someone goes to that page during checkout, the status will change. Be aware it may take a few hours for the tag to show as verified.

Option 2: Google Analytics Setup

To follow the Google Analytics Setup, you will need to create a Google Tag Manager account. You’ll use this account for creating and managing ads.

Step 1: Creating a New Tag

1. Open Google Tag Manager.

2. Click Tags, then click Create a new tag. A menu will pop up, and you’ll need to name it (like GA4 Configuration, for example) at the top left.

3. Click Tag Configuration, and another menu will pop up. Click on GA4 Configuration.

4. Navigate to your GA4 account so you can find your stream ID. To get there, click on Admin, then Data Streams.

google analytics data stream menu

You’ll see the Measurement ID. Copy this number and go back to Google Tag Manager, pasting the number in the empty field. Under triggering, you’ll want to make sure All Pages is selected so the tag fires on each page of your website. Before you publish it, you’ll want to name it (typically, you can use the same name as you did in Tag Manager). 

5. Click Publish.

Step 2: Install Google Tag Manager in Shopify

6. Once you’ve created your tag, a new window will pop up reading “Install Google Tag Manager” with code. Copy the Google Tag Manager code in the top box. 

7. Navigate to the back end of your Shopify store.

8. Click Online Store, then Themes.

9. Click the ellipsis (…), then look for the theme.liquid file in the left hand menu, and click to open it.

10. Find the <head> tag, and hit enter for a new line. Paste the Google Tag Manager code here.

heading code in the back end of shopify

11. Copy the following code and paste it before the Google Tag Manager Code you just put in the theme.liquid.

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

12. Go back to Google Tag Manager, and copy the body code.

13. Navigate back to Shopify and find the <body> tag.

body code in the back end of shopify

14. Hit enter, and paste this code under that tag. (If you have previously added GA4 manually through theme.liquid, you’ll want to remove it, and replace it with the Google Tag Manager code.)

15. Click save.

Step 3: Building the Event

16. In Google Tag Manager, click on Add a New Tag. Give your tag a descriptive name (like GA4 Ecomm Event). 

add a new google tag in google tag manager

17. Click Tag Configuration.

tag configuration option in google tag manager

When the menu pops up, click on Google Analytics.

google tag configuration options

18. When a new menu pops up, choose Google Analytics: GA4 Event.

google tag manager google analytics 4 event option

19. Put your Measurement ID in the appropriate field.

20. For the event name section, click on the plus button. Choose Event.

21. Click on More Settings, and when the menu drops down, check the box that says Send Ecommerce Data. Make sure the next box says Data Layer.

options for the event in tag configuration

22. Click on the Triggering section next, and name this Trigger $GA4 Ecomm Event or another name of your choice.

trigger section in google tag manager

23. Find the plus (+) button in the top right hand corner. On this page, look for a pencil icon on the right hand side of the Trigger Configurer button, and a new menu will pop up. Scroll down until you see Custom Event, and click on it.

custom event in trigger section of google tag manager

24. In the field below, paste this line View_item|add_to_cart|begin_checkout|add_payment_info|add_shipping_info|purchase These all track some of the most important Shopify purchases to give you the most accurate data. Make sure the box that reads “Use Regex Matching” is checked.

trigger menu options filled out in google tag manager

25. Click Save, and then Save on the next menu. You will be taken back to the main Tags page.

26. To make your changes live, click the blue button on the right hand side that says Submit/Publish. Name it GA4 Ecomm Events (or whatever name you chose for your event), then click the blue Publish button so your work shows up in GA4.

Step 4: Import Transaction Goal into Google Ads Account

27. Log into your GA account.

28. Scroll down to find Admin and click on it.

29. Locate Google Ads Link, and click on it.

google ads link

30. Click the blue button that says “Link.”

31. A new menu will appear. You’ll need to connect your Google Ads account. Click on the blue text that reads, “Choose Google Ads accounts.”

creating a link with google ads in google analytics

Choose the account you want to link by marking a check box, then click the blue Confirm button. Click Next in the Link setup menu.

google ads account choice in google analytics

32. Under Configure settings, click the toggle that enables Personalized Advertising. Also click the toggle that allows access to Analytics features in Google Ads. Then click Next.

link setup in google analytics to connect to google ads

33. Click Next, and then click the Submit button.

34. Open a new tab where you’ve logged into your Google Ads account. Go to Tools and Settings, then click Conversions.

google ads navigation menu

35. Click the “Add a New Conversion” button. When the menu comes up, click on the Import choice.

google ads import

36. Another menu will pop up, and you’ll click on the GA4 option and make sure the Web part is highlighted. Click Continue.

google analytics web option in google ads

37. Choose the purchase event you created in GA4, and click Import it into Google Ads.

Sometimes it may take a few hours for the purchase event to appear, so if it isn’t showing up immediately, wait a few hours and try again.

Benefits of Setting Up Google Ads Conversion Tracking on Shopify

You may see all of these instructions and think to yourself, “Is all of this worth my time and effort?” Absolutely!

When you set up this type of tracking, you’ll be able to see data on conversions for your campaigns, ad groups, ads, and keywords. It helps you understand how your advertising is performing and how it helps you achieve business goals.

Ultimately, you’ll be able to know which ads you should keep running and which ones you should turn off based on how much money they bring in.

Now you know how to set up Google Ads conversion tracking on Shopify. We understand that working with code can be overwhelming. If you’re not comfortable doing it on your own, we would be happy to help! Reach out to our web development experts for assistance today!

Leave a Reply