Google Ads Conversion Tracking - Shopify Checkout Tag

Task 1


Prompt

The client has just created a new Google Ads account, and their Ecommerce platform is Shopify. Below is a broken Google Ads Conversion Tracking Tag. The value parameter should be Order Subtotal (which should not include a currency symbol or any commas), and we will also be including a new parameter, transaction_id which will be the Order Number. Revenue is only showing up for orders less than $1,000, and orders are being duplicated. Please help!

Bonus

Shopify has a piece of code that only allows a script to fire the first time a page is accessed, can you add that as well?

Code

For reference, here is the original code snippets included with the task with some additional formatting to make it pretty. 😄

Click to view the code

<!-- Global site tag (gtag.js) - Google Ads: 123456789 -->  
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-123456789"></script>  
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}  
  gtag('js', new Date());
  gtag('config', 'AW-123456789'); 
</script>  
<!-- Event snippet for Test conversion page -->  
<script>
  gtag('event', 'conversion', {  
      'send_to': 'AW-123456789/AbC-D_efG-h12_34-567',  
      'value': {{ subtotal_price | money_without_currency }},  
      'currency': '{{ currency }}',  
      'transaction_id': '{{ transaction_id }}'  
    });  
</script> 

Final Solution


Don’t want to wade through the subtasks?

Inferred Subtasks


Below is a list of tasks derived from the prompt, the relevant text from the prompt, and links to the solutions:

The value parameter should be Order Subtotal (which should not include a currency symbol or any commas).

  1. Make value parameter Order Subtotal and remove currency symbol and commas.

👉 Subtask 1 Solution

we will also be including a new parameter, transaction_id which will be the Order Number.

  1. Set transaction_id parameter to Order Number.

👉 Subtask 2 Solution

Revenue is only showing up for orders less than $1,000

  1. Ensure all revenue amounts are showing.

👉 Subtask 3 Solution

orders are being duplicated.

  1. Prevent collection of duplicate orders.

👉 Subtask 4 Solution

Bonus Shopify has a piece of code that only allows a script to fire the first time a page is accessed, can you add that as well?

  1. Add code to ensure script only fires the first time a page is accessed.

👉 Subtask 5 Solution

NEXT
Google Ads Conversion Tracking - Subtask 1