How To Setup Google AdWords PPC Conversion Tracking In Shopify

Option 1: If you already track sales in Google Analytics, the quickest solution is to import your transactions as a conversion. See the alternative solution below.

Option 2: This tutorial covers why you need to edit the existing AdWords 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 AdWords sales are lost to the (direct)/(none) traffic source due to cross-domain tracking limitations when using Google Analytics. This means AdWords would lack the proper attribution it deserves for generating sales, which ruins your ability to optimize ad campaigns. For one of my AdWords clients I was able to correctly attribute more than double the sales of AdWords 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.

Follow this simple three-step tutorial to setup Google AdWords conversion tracking for your Shopify store. The article below has some improvements on the video tutorial:

1. Create Your Conversion In AdWords

1. In your AdWords account, click “Tools” in the top menu then “Conversions”:

Google AdWords conversion tab

2. Create a new conversion:

Google AdWords new conversion

Use the following settings for your conversion:

  • Name:Your name can be anything. I recommend you make it “Sales”
  • Value: “The value of this conversion action may vary (for instance, by purchase price)”
  • Count: “All conversions”
  • Conversion windows: “30-day conversion window, 30-day view-through conversion window”
  • Category: “Purchase/Sale”
  • Optimization: “Allow bid optimization for this conversion action”. This is easiest for new advertisers

3. Save to finish creating your conversion code in AdWords. Your code will look something like:

Now it’s setup right on the side of AdWords, you just need to configure your code then add to your Shopify store to finish setting up Google AdWords conversion tracking.

2. Configure The Conversion Code

Your code at the moment will look something like:

<!-- Google Code for Sales Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 992160322;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "s8NFCPLRsVsQwtSM2QM";
var google_conversion_value = 1.00;
var google_conversion_currency = "AUD";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/992160322/?value=1.00&amp;currency_code=AUD&amp;label=s8NFCPLRsVsQwtSM2QM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

You can add this to your Shopify store, but I recommend you make some minor alterations to the code so the order value is passed to AdWords. In optimising your AdWords campaign, you want to improve it based on generated revenue, not just “this campaign got 10 sales versus the other with 30 sales”.

1. Replace the line:

var google_conversion_value = 1.00;

…with:

if ({{ subtotal_price }}) { var google_conversion_value = {{ subtotal_price | money_without_currency }}; }

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

2. Replace the line:

<img style="border-style: none;" alt="" src="//www.googleadservices.com/pagead/conversion/992160312/?value=1.00&amp;currency_code=AUD&amp;label=s8NFCPLRsVsQwtSM2QM&amp;guid=ON&amp;script=0" height="1" width="1" />

…with:

<img style="border-style: none;" alt="" src="//www.googleadservices.com/pagead/conversion/992160312/?value={{ subtotal_price | money_without_currency }}&amp;currency_code=AUD&amp;label=s8NFCPLRsVsQwtSM2QM&amp;guid=ON&amp;script=0" height="1" width="1" />

If you skip this step, sales that occur in web browsers that have javascript disabled will not be tracked. So do it!

 

Some stores use a comma separated currency in “General” > “Settings” with the code {{amount_with_comma_separator}}. This means the google_conversion_value variable will have a comma, which does not work with AdWords. 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: ',', '.'

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

Add the following after the line that declares the “google_conversion_id” variable:

if ({{ order.order_number }}) { var google_conversion_order_id = "{{ order.order_number  }}"; }

If javascript is disabled, we need to ensure no repeat conversions for a single conversions. Add the next line of code as a new variable inside the <noscript> section:

&amp;oid={{ order.order_number }}

4. For whatever reason, implementing google_conversion_order_id and oid from the step above does not always stop duplicate conversion data. I’ve seen it happen repeatedly for my AdWords clients. I recommend you wrap the entire AdWords 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 both mentions of “subtotal_price” with “total_price”:

if ({{ total_price }}) { var google_conversion_value = {{ total_price | money_without_currency }}; }

and

<img style="border-style: none;" alt="" src="//www.googleadservices.com/pagead/conversion/992160322/?value={{ total_price | money_without_currency }}&amp;currency_code=AUD&amp;label=s8NFCPLRsVsQwtSM2QM&amp;guid=ON&amp;script=0" height="1" width="1" />

3. Adding The Google AdWords Conversion Code To Shopify

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

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

Shopify settings checkout

3. Under the field “Shopify additional content & scripts”:

Shopify additional content and scripts

Paste your updated AdWords conversion code, which will look like:

{% if first_time_accessed %}
<!-- Google Code for Sales Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 992160322;
if ({{ order.order_number }}) { var google_conversion_order_id = "{{ order.order_number  }}"; }
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "s8NFCPLRsVsQwtSM2QM";
if ({{ subtotal_price }}) { var google_conversion_value = {{ subtotal_price | money_without_currency }}; }
var google_conversion_currency = "AUD";
var google_remarketing_only = false;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/992160322/?value={{ subtotal_price | money_without_currency }}&amp;currency_code=AUD&amp;oid={{ order.order_number }}&amp;label=s8NFCPLRsVsQwtSM2QM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
{% endif %}

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

 

You can test the tracking is working 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 AdWords tracking, temporarily remove that so you can view the order status of an existing order.

Alternative: Google Analytics Import

The above method will work with everyone. There is another way that requires Google Analytics. I prefer to avoid this method for non-Plus stores because sales can be lost to the (direct)/(none) traffic source due to cross-domain tracking limitations. To check if you can use this method, you need to see your sales data in the “Conversions” section of your analytics:

Google Analytics enhanced ecommerce

If you see similar data going into your Google Analytics, you can import the transaction goal into your AdWords to setup tracking. I recommend you go through my Google Analytics setup in Shopify for clean data in Analytics.

1. On the conversions page in AdWords, click on “Google Analytics”.

2. Click the checkbox for the “Transactions” goal for the correct property and click “Continue”.

3. For the value field, select “The value of this conversion action is managed in Analytics”.

4. Check “Use the currency provided with the value in Analytics”. Click “Done” just below then “Import goals” at the bottom.

Import Google Analytics goal into AdWords


Leave a Reply

Your email address will not be published. Required fields are marked *

Google Partners Digiwolves