Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to Setup Google Ads Conversion Tracking in Shopify

Having done over one hundred audits of Google Ad accounts for Shopify businesses, I am dumbfounded at the number of accounts that don’t have conversion tracking accurately setup. Some stores spend thousands each month with no idea what, if any part of the campaigns, generate sales. Other businesses may track a sale as one conversion, but they have no revenue data—the sale of a $10 product looks the same as a $1000 product. If your return on ad spend (ROAS) goal is 500%, you have to know what searches, ads, products, and audiences succeed or fail at bringing in $5 for every $1 of spend.

Previously known as Google AdWords, Google Ads has two ways to setup conversion tracking in Shopify.

Option 1: If you accurately track sales in Google Analytics, the quickest solution is to import your transactions as a conversion goal. See the steps to import transactions from analytics to Google Ads.

Option 2: This tutorial covers why you need to edit the existing Google Ads conversion code and how to do it for the best data. I use this solution to help Shopify stores grow.

I recommend the second option because my testing has repeatedly shown sales through Google Ads are lost to the (direct)/(none) traffic source in Google Analytics due to cross-domain tracking limitations of payment processors. This means your advertising would lack the proper attribution it deserves for generating sales, which ruins your ability to optimise ad campaigns. For one of my Google Ads clients I was able to attribute more than double the sales of Google Ads with the conversion tracking code compared to analytics. That level of data accuracy can be the difference between the death of an ecommerce business and it thriving.

You will learn how to setup Shopify with gtag tracking for Google Ads. One benefit of gtag, released at the end of 2017, is its simplicity. The second benefit is its increased accuracy over the older ga() functions to combat intelligent tracking prevention in Safari. Here we go.

1. Create your conversion in Google Ads

1. In your Google Ads account from the top-right, click the spanner icon. Under the “Measurement” column, go to “Conversions”:

2. Create a new conversion. Click “Website”.

Use the following settings for your conversion:

  • Name: The name can be anything. I recommend you make it “Sales”
  • Category: “Purchase/Sale”
  • Value: “Use different values for each conversion” and select the currency used in your Shopify store. This should also mimic the currency in your ad account, which cannot be changed. You could enter your average order value (AOV) taken from Google Analytics as the default value. Your average order value can be gather from the “Conversions” > “Ecommerce” > “Overview” section. However, as you’ll see, this value is never empty because we’ll replace this with a liquid variable that contains the order amount in dollars.
  • Count: “Every”.
  • Conversion windows: “30 days”. If your products cost more than $200 or you know customers take weeks to research a product before buying, extend the value to “90 days”.
  • View-through conversion window: “1 day”.
  • Include in “Conversions”: Tick this option. The setting lets you decide if these conversions should be included in your “Conversions” and “Conversion value” columns
  • Attribution: “Linear”. Let’s say a person clicks one ad then returns to Google for another search. They then click another ad and buy. The first ad should receive recognition for the sale so you can more accurately optimise campaigns with this data. The linear model means each ad and search term will get 0.5 of a conversion. If you used the last-click option, the first ad would get 0 and the second ad would get 1 conversion. Never use the last-click option because it ignores the effect of upper funnel ads. I suggest you learn more about attribution models as other types can be more appropriate. Linear though, is a good default.

Your event tag options will look something like:

3. Save to finish creating your conversion code in Google Ads. Select the option to “Install the tag yourself”.

4. Click “I haven’t installed the global site tag on my website” option for the global site tag.

5. Click the “Page load” option for the event tag.

We will need to modify the event tag then add the global tag and the modified event tag to your Shopify store to complete setup.

2. Configure the Conversion Code

Your event code responsible for Google Ads tracking will look something like:


Do not add this to your Shopify store. You will need to make alterations so the order value and order ID is passed to Google. When optimising your campaign, you want to improve it based on the generated revenue, not just “this campaign got 10 sales versus the other with 12 sales”.

1. Replace the line:

'value': ,

…with:

'value': {{ subtotal_price | money_without_currency }},

This parses the value of the purchase without shipping and other taxes like GST.

Some stores use a comma separated currency in “General” > “Settings” with the code {{amount_with_comma_separator}}. This means the value variable will have a comma, which does not work with Google Ads. If your store formats its currency with a comma often seen in European currencies, steps one and two need to be modified with the replace filter like {{ subtotal_price | money_without_currency | replace: ',', '.' }}. If the store uses Norwegian Krone that has a comma for decimals and separates three digits with a full stop (like 1.000,00), use this filter | remove: '.' | replace: ',', '.'

2. While you can get away with the first two steps, I recommend you use the transaction_id parameter to prevent duplicate conversions when customers visit the thank you page a second time.

Replace the line:

'transaction_id': ''

…with:

'transaction_id': '{{ order.order_number  }}'

3. For whatever reason, implementing transaction_id does not always stop duplicate conversion data. I’ve seen it happen repeatedly for my Google Ads clients. I recommend you wrap the entire tracking code in the following liquid, which runs scripts only on their first time of the order status page: {% if first_time_accessed %}...{% endif %}

If you want to include taxes and shipping, replace “subtotal_price” with “total_price”:

'value': {{ total_price | money_without_currency }},

3. Configure the Global Site Tag

I suggest installing the global site tag only on the thank you page inside the “if statement”. Shopify is not setup to run gtag site-wide. gtag contains the analytics.js library used by your standard Shopify analytics setup.

If you install the gtag in your theme.liquid file and have GA setup, you will send duplicate pageview data. That is why we will use the send_page_view parameter like { 'send_page_view': false } to disable duplicate page views sent to analytics.js.

For your global site tag on the order confirmation page, replace the line:

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

…with:

gtag('config', 'AW-880123456', { 'send_page_view': false });

4. Adding the Google Ads Conversion Code to Shopify

1. Log into the admin section of your Shopify store.

2. Go to “Settings” > “Checkout”.

3. Under the field “Additional scripts”, paste your Global site tag and the updated Google Ads conversion code inside the conditional tag. All this code should look like:

{% if first_time_accessed %}


{% endif %}

4) Click “Save” in Shopify and you’re done! You will now start receiving conversion value data inside Google Ads.

You can immediately test the tracking works by viewing the thank you page for an order then search the source code for the snippet to confirm the values inserted for the order ID and conversion value are what you want. If you’re using {% if first_time_accessed %} around your tracking, temporarily remove that so you can view the order status of an existing order.

For other debugging, go to the conversions section in Google Ads, click on the conversion, then click on “Webpages” from the top to view what pages are triggering the conversion.

Alternative: Google Analytics Import

The above method will work with everyone. However, there is another way that requires Google Analytics. I use the Google Analytics method after running the conversion code method above then seeing it is less accurate than the sales from google / cpc in Google Analytics.

If you see the google / cpc channel has less sales data than Google Analytics, pause your original goal then import the transaction goal into your Google Ads. Go through my Google Analytics setup in Shopify for clean data in Analytics.

1. Create a new conversion. Click “Import”.

2. Select the type “Transaction” from the primary view you use in Google Analytics that has the most complete and accurate data.

3. Click “Import and Continue”.

4. Once you’ve created the goal, click on it to edit it. The only value I suggest you change is the attribution model from “Last Click” to “Linear”. Your settings will look like:

You are done importing transaction data from Google Analytics into Ads.

As a Shopify Marketing Expert and Google Partner, we’ve helped many Shopify stores grow with Google Ads. If you’d like us to take away the stress of doing paid advertising well, read about our Google Ads service for Shopify stores.

The post How to Setup Google Ads Conversion Tracking in Shopify appeared first on Digital Darts.



This post first appeared on Shopify Marketing Blog - Digital Darts, please read the originial post: here

Share the post

How to Setup Google Ads Conversion Tracking in Shopify

×

Subscribe to Shopify Marketing Blog - Digital Darts

Get updates delivered right to your inbox!

Thank you for your subscription

×