Master Conversion Tracking: Google Analytics 4 & Shopify

Master Conversion Tracking: Google Analytics 4 & Shopify

Table of Contents

  1. Introduction
  2. Setting up Google Analytics for Shopify Store
    1. Create a Google Analytics Account
    2. Link Google Analytics Account to Shopify Store
  3. Installing Tracking Code on Shopify Store
  4. Verifying Installation of Tracking Code
  5. Setting up Conversion Data in Google Analytics
  6. Excluding Unwanted Referrals in Google Analytics
  7. Adding Old Version of Analytics to the Store
  8. Enabling Ecommerce and Enhanced Ecommerce Reporting
  9. Linking Google Analytics and Google Ads Accounts
  10. Setting up Conversion Tracking in Google Ads
  11. Conclusion

Setting up Conversion Tracking for Google Ads and Google Analytics in Shopify

In today's digital marketing landscape, it's essential to track and measure the effectiveness of your advertising efforts. Without proper tracking, it's challenging to determine the ROI of your campaigns and make data-driven decisions. Fortunately, setting up conversion tracking for Google Ads and Google Analytics in your Shopify store is relatively straightforward.

1. Introduction

In this article, we will guide you through the process of setting up conversion tracking for Google Ads and Google Analytics in your Shopify store. By following these steps, you will be able to track the actual sales amounts from your Google Ads campaigns directly in your Google Ads and Google Analytics accounts. This valuable data will enable you to analyze the performance of your campaigns, optimize your targeting and bidding strategies, and make informed marketing decisions.

2. Setting up Google Analytics for Shopify Store

The first step in setting up conversion tracking is to create a Google Analytics account and link it to your Shopify store.

2.1 Create a Google Analytics Account

To create a Google Analytics account, follow these simple steps:

  1. Go to analytics.google.com and log in with your Gmail account.
  2. Click on "Start Measuring" to begin setting up your Google Analytics account.
  3. Provide an account name, which should be the name of your store.
  4. Select the appropriate account data sharing settings and click "Next."
  5. Enter the property name, which can be the same as your store name.
  6. Set your time zone and currency.
  7. Fill in the necessary business information and accept the terms and conditions.
  8. Choose your email communication preferences, and click "Create."
  9. Once the account is created, click "Admin" at the bottom, then "GA4 setup assistant."
  10. Click on "I want to create a new Google Analytics 4 Property" and follow the instructions to create the property.

2.2 Link Google Analytics Account to Shopify Store

Now that you have a Google Analytics account, it's time to link it to your Shopify store:

  1. Access your Shopify dashboard and navigate to the "Online Store" section.
  2. Click on "Themes" and then select "Actions" followed by "Edit code."
  3. In the left-hand menu, select "theme.liquid" and scroll down to the "head" section.
  4. Add the following code snippet right before the closing tag:
<script async src="https://www.googletagmanager.com/gtag/js?id=YOUR_MEASUREMENT_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'YOUR_MEASUREMENT_ID');
</script>

Replace YOUR_MEASUREMENT_ID with the Measurement ID you obtained from your Google Analytics account.

  1. Save your changes by clicking "Save" and ensure that it displays "Asset saved" at the bottom.

3. Installing Tracking Code on Shopify Store

After linking your Google Analytics account, the next step is to install the tracking code on your Shopify store. Follow these steps:

  1. Access your Shopify dashboard and navigate to the "Online Store" section.
  2. Click on "Themes" and then select "Actions" followed by "Edit code."
  3. In the left-hand menu, select "theme.liquid" to open the theme's code editor.
  4. Scroll down to the "head" section and create a new line.
  5. Type <script> to start a new JavaScript code block.
  6. On the next line, enter the tracking code provided by Google Analytics.
  7. Press "Save" to save the changes.
  8. Confirm that the tracking code has been installed correctly.

4. Verifying Installation of Tracking Code

To ensure that the tracking code is installed correctly and sending data to Google Analytics, follow these steps:

  1. Open your Shopify store's front end in a separate browser tab.
  2. Browse through different pages on your store and perform some actions.
  3. Keep this window open and go back to Google Analytics in another tab.
  4. Access the "Real-time" section under "Reports" in the left-hand menu.
  5. If you don't see any data immediately, wait for a few minutes and refresh the page.
  6. Check to see if the Real-time report displays the visitors on your website.
  7. If you don't see any data, try refreshing the Google Analytics page or accessing your store in an incognito/private window.
  8. If data still doesn't appear, double-check the installation of the tracking code by viewing the page source and searching for the Google Analytics name.
  9. If necessary, clear the cache for your browser and store, and repeat the verification process.

Once the tracking code is properly installed, you should start seeing data for the people visiting your store in Google Analytics. Keep in mind that it may take up to 48 hours for data to appear in all the available tabs and reports.

5. Setting up Conversion Data in Google Analytics

To ensure that crucial conversion data, such as sales revenue, is accurately tracked in Google Analytics, you need to add additional scripts to your Shopify store:

  1. Access your Shopify dashboard and navigate to the "Settings" section.
  2. Select "Checkout" and scroll down to the "Additional scripts" section, below the "Order processing" settings.
  3. In the "Additional scripts" box, paste the provided Analytics code, which looks like this:
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('event', 'purchase', {
    'transaction_id': {{ order.order_number }},
    'value': {{ order.subtotal_price | money_without_currency }},
    'currency': {{ shop.currency }}
  });
</script>

Note that you need to make some changes to the code:

  • Replace {{ order.order_number }} with the variable or liquid template that represents your order number.
  • Replace {{ order.subtotal_price | money_without_currency }} with the variable or liquid template that represents your order's subtotal price.
  • Replace {{ shop.currency }} with the variable or liquid template that represents your shop's currency.
  1. Save the changes by clicking "Save."

By adding this code, you ensure that Google Analytics receives the necessary information about each transaction, allowing you to track the conversion values accurately.

6. Excluding Unwanted Referrals in Google Analytics

To ensure that Shopify checkout pages and payment gateways do not appear in your reports, it's important to exclude them as referrals in Google Analytics:

  1. Go to the Google Analytics admin page.
  2. Click on the "Data Stream" for your Shopify store.
  3. Scroll down to the "More tagging settings" section and click on "List unwanted referrals."
  4. Add "checkout.shopify.com" as an excluded referral and click "Save."
  5. Additionally, exclude payment gateways such as "stripe.com," "paypal.com," and "pay.google.com" to further refine your reports.
  6. Remember to save your changes.

By excluding these domains, you ensure that your reports focus on relevant traffic sources and provide accurate insights into the performance of your campaigns.

7. Adding Old Version of Analytics to the Store

Although we have primarily focused on Google Analytics 4, it's a good practice to add the old version of Analytics (Universal Analytics) as a backup. Follow these steps to add the old version:

  1. Go to your Shopify dashboard and navigate to the "Online Store" section.
  2. Select "Preferences" and scroll down to the "Google Analytics" section.
  3. Return to Google Analytics and access the admin page.
  4. Scroll down and click on "Show advanced options."
  5. Select the appropriate options and enter your website URL.
  6. Set the time zone, currency, and other relevant information.
  7. Click "Next" and fill out the business information.
  8. Click "Create" to create the Google Analytics property.
  9. Copy the Global Site Tag provided by Google Analytics.
  10. Go back to your Shopify store's preferences and paste the Global Site Tag in the Google Analytics account box.
  11. Save the changes.

Adding the old version of Analytics ensures that you have a backup tracking system in case any issues occur with Google Analytics 4.

8. Enabling Ecommerce and Enhanced Ecommerce Reporting

To fully leverage the power of Google Analytics for tracking ecommerce performance, you need to enable ecommerce and enhanced ecommerce reporting:

  1. Access your Google Analytics account and navigate to the desired view.
  2. Click on "eCommerce settings" in the "View" column.
  3. Enable ecommerce tracking by toggling the button.
  4. Ensure that "Enhanced ecommerce reporting" is also enabled.
  5. Click "Save" to save the settings.

By activating these features, you gain access to detailed reports on shopping behavior, product performance, and other ecommerce-specific metrics.

9. Linking Google Analytics and Google Ads Accounts

To connect your Google Analytics and Google Ads accounts, follow the steps below:

  1. Log into your Google Ads account.
  2. Access the "Tools and settings" menu and click on "Linked Accounts."
  3. Find "Google Analytics GA4" and click on "Details."
  4. Ensure that you are logged in with the email address used to create the Google Analytics account.
  5. Select your Google Analytics property from the options listed.
  6. Click "Link" and enable "Import audiences."
  7. Confirm the link by clicking "Link."
  8. Make sure to turn on auto-tagging for your Google Ads account.

By linking these accounts, you can unlock powerful features such as importing conversions from Google Analytics into Google Ads and gaining insights into the performance of your campaigns.

10. Setting up Conversion Tracking in Google Ads

The final step is to set up conversion tracking in your Google Ads account:

  1. Access your Google Ads account and go to the "Tools and settings" menu.
  2. Under the "Measurement" section, click on "Conversions."
  3. Click the "+conversions" button to add a new conversion.
  4. Choose to import conversions from Google Analytics.
  5. Select the appropriate Google Analytics property, and choose the event you want to track.
  6. Click "Import and continue" to import the conversions.
  7. Once the import is complete, click "Done."
  8. You can further customize the attribution settings by going into the conversion action and selecting the desired attribution model.

By setting up conversion tracking in Google Ads, you can accurately measure the performance of your campaigns and optimize your advertising efforts.

11. Conclusion

Setting up conversion tracking for Google Ads and Google Analytics in your Shopify store is crucial for understanding the effectiveness of your advertising campaigns and making data-driven decisions. By following the steps outlined in this article, you can ensure that you have the necessary insights to optimize your marketing strategies and drive more sales for your ecommerce store.

Remember, proper tracking and analysis are paramount to improving your ROI and achieving long-term success in the competitive digital landscape.

Thank you for reading this article. If you found it helpful, don't forget to like and share. If you have any questions or feedback, please leave a comment below.

I am a shopify merchant, I am opening several shopify stores. I use ppspy to find Shopify stores and track competitor stores. PPSPY really helped me a lot, I also subscribe to PPSPY's service, I hope more people can like PPSPY! — Ecomvy

Join PPSPY to find the shopify store & products

To make it happen in 3 seconds.

Sign Up
App rating
4.9
Shopify Store
2M+
Trusted Customers
1000+
No complicated
No difficulty
Free trial