Why is my Google Ads conversion tracking inactive?

gruff
Tourist
27 0 2

Hi,

 

Tried to setup a Google Shopping campaign and the Conversion Action Purchase has a tracking status of "Inactive".

Screenshot 2024-02-21 at 21.43.42.jpg

I have the google & youtube app installed which is showing the Conversion tracking as being correct.

Screenshot 2024-02-21 at 21.50.03.jpg

Unsure what else I need to be doing or checking. Any ideas?

  

 

 

Replies 11 (11)
gruff
Tourist
27 0 2

Thanks. Checked the "order status page" section in Settings > Checkout. 

 

Code is below. Is this the correct code to be featuring? Or should I be using Pixel?

{% if first_time_accessed %}
  <!-- Event snippet for Test conversion page -->
  <script>
    gtag('event', 'conversion', {
      'send_to': 'AW NUMBER',
      'value': {{ checkout.subtotal_price | divided_by: 100.0 }},
      'currency': '{{ currency }}',
      'transaction_id': '{{ order_id }}',
    });
  </script>
{% endif %}

 

 

 

EmmanuelFlossie
Shopify Partner
3071 226 734

No it is missing the gtag. It should be:

 

<!-- FEEDARMY START Global site tag (gtag.js) - Google Ads V2.2 -->
<!-- For the latest and updated code or tutorial: https://feedarmy.com/kb/adding-adwords-conversion-tracking-to-shopify/ -->
{% assign fa_send_to = 'AW-123456789/abcdefghijlklmnopq' %}

{% comment %}DO NOT EDIT BELOW{% endcomment %}
{% if fa_google_coding %}{% assign fa_google_coding = true %}{%- else -%}{% assign fa_google_coding = false %}{%- endif -%}
{% assign fa_google_ids = fa_send_to | split: "/"  %}

{% if fa_google_coding == false %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{fa_google_ids[0]}}"></script>
{%- endif -%}
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', '{{fa_google_ids[0]}}', {'allow_enhanced_conversions':true});
  var checkout = window.Shopify.checkout;
</script>
{% if first_time_accessed %}
<script>
  gtag('event', 'conversion', {
      'send_to': '{{ fa_send_to }}',
      'value': checkout.total_price_set.presentment_money.amount,
      'currency': checkout.total_price_set.presentment_money.currency_code,
      'transaction_id': '{{ order_id }}',
  });
  var enhanced_conversion_data = {
    {% unless billing_address.first_name == blank %}"first_name": "{{ billing_address.first_name }}",{% endunless %}
    {% unless billing_address.last_name == blank %}"last_name": "{{ billing_address.last_name }}",{% endunless %}
    {% unless checkout.email == blank %}"email": "{{ checkout.email }}",{% endunless %}
    {% unless billing_address.phone == blank %}"phone_number": "{{ billing_address.phone }}",{% endunless %}
    "home_address": {
      {% unless billing_address.street == blank %}"street": "{{ billing_address.street }}",{% endunless %}
      {% unless billing_address.city == blank %}"city": "{{ billing_address.city }}",{% endunless %}
      {% unless billing_address.province_code == blank %}"region": "{{ billing_address.province_code }}",{% endunless %}
      {% unless billing_address.zip == blank %}"postal_code": "{{ billing_address.zip }}",{% endunless %}
      {% unless billing_address.country_code == blank %}"country": "{{ billing_address.country_code }}"{% endunless %}
    }
  };
</script>
{% endif %}
<!-- FEEDARMY END Global site tag (gtag.js) - Google Ads V2.2 -->
Get in touch with Emmanuel: a Google Shopping Specialist, Google Ads Diamond Product Expert, and also a a Google Product Expert Education 2021 & Tailwind 2023 Award winner.
Need Google Merchant Center or Google Shopping support?.
gruff
Tourist
27 0 2

@EmmanuelFlossie thanks for the solution. Looked through your code and noticed that it references Google Tag manager. This is something that isn't setup in the Google & You Tube App. I'm not sure the code will work without setting Google Tag Manager up. Is this opening up a can of worms?? 🙄

EmmanuelFlossie
Shopify Partner
3071 226 734

All Google GTAG tracking is hosted on the website URL googletagmanager.com But has nothing to do with the platform GTM.

Get in touch with Emmanuel: a Google Shopping Specialist, Google Ads Diamond Product Expert, and also a a Google Product Expert Education 2021 & Tailwind 2023 Award winner.
Need Google Merchant Center or Google Shopping support?.
gruff
Tourist
27 0 2

Going through the site checking the setup but I'm reading different approaches online.

 

Firstly the code that appears on each page that appears below the <HEAD> tag. Should you be installing Google Tag Manager or Google Tag?

 

Option - Google Tag Manager

 

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-GTM_CODE');</script>
<!-- End Google Tag Manager -->

 

 

Option - Google Tag

 

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=Tag_ID"></script>
<script>
 window.dataLayer = window.dataLayer || [];
 function gtag(){dataLayer.push(arguments);}
 gtag('js', new Date());
 gtag('config', 'Tag_ID');
</script>

 

 

gruff
Tourist
27 0 2

Most of the way there. Went with Google Tag manager over Google Tag.

 

Carried out the following steps:

  1. Installed Google Tag Manager
  2. Installed the tags, triggers and variables
  3. Linked to Google Analytics and Ads

The event is firing for "Purchase" which is great however there are a number of variables which are not being populated on the thank you page.

 

Variables in Google Tag Manager have been setup as:

  • E-Commerce Transaction ID is "ecommerce.transaction_id"
  • E-Commerce Currency is "ecommerce.currency"

Code on the Shopify thank you page below with the variables not being populated:

transaction_id: '{{ order_id }}',
currency: checkout.total_price_set.presentment_money.currency_code,

 

Is there a different Shopify variable that I should be using?

<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });
{% if first_time_accessed %}
dataLayer.push({
  event: "purchase",
  ecommerce: {
      transaction_id: '{{ order_id }}',
      value: {{ total_price | times: 0.01 }},
      tax: {{ tax_price | times: 0.01 }},
      shipping: {{ shipping_price | times: 0.01 }},
      currency: checkout.total_price_set.presentment_money.currency_code,
      items: [
       {% for line_item in line_items %}{
        item_id: "{{ line_item.product_id }}",
        item_name: "{{ line_item.title | remove: "'" | remove: '"' }}",
        currency: checkout.total_price_set.presentment_money.currency_code,
        price: {{ line_item.final_price | times: 0.01 }},
        quantity: {{ line_item.quantity }}
      },{% endfor %}
 ]
  }
});
{% endif %}
</script>
  <!-- Google Tag Manager -->
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  })(window,document,'script','dataLayer','GTM-TAG');</script>
  <!-- End Google Tag Manager -->

 

gruff
Tourist
27 0 2

Hi @EmmanuelFlossie ,

 

Gone with Google Tag Manager and used some of your code on the checkout page however there are variables which are not being populated:

 

The variables are:

transaction_id: '{{ order_id }}',
currency: checkout.total_price_set.presentment_money.currency_code,

 

Have the variables been specified in the correct way?

EmmanuelFlossie
Shopify Partner
3071 226 734

As you edited the code, or used snippets, you are missing code to make it work.

If you look at the currency the variable is checkout, which you removed.

Get in touch with Emmanuel: a Google Shopping Specialist, Google Ads Diamond Product Expert, and also a a Google Product Expert Education 2021 & Tailwind 2023 Award winner.
Need Google Merchant Center or Google Shopping support?.
EmmanuelFlossie
Shopify Partner
3071 226 734

If you are using the Google and Youtube app for conversion tracking, then GTM is not used. So the second screenshot is irrelevant.

Get in touch with Emmanuel: a Google Shopping Specialist, Google Ads Diamond Product Expert, and also a a Google Product Expert Education 2021 & Tailwind 2023 Award winner.
Need Google Merchant Center or Google Shopping support?.
gruff
Tourist
27 0 2

Thanks @EmmanuelFlossie and @robiulawoalraju for your help so far. Think I'm really close. Planning on disabling the Google and Youtube App and sticking with GTM that I have setup. 

 

Code that I'm using in the checkout is below. Two variables which are not working are:

- Currency

- Order ID

 

Couple of questions:

1. Can you advise what variables I should be using? 

2. Is the code below correct?

 

 

Code

<script>
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });
{% if first_time_accessed %}
dataLayer.push({
  event: "purchase",
  ecommerce: {
      transaction_id: '{{ order_id }}',
      value: {{ total_price | times: 0.01 }},
      tax: {{ tax_price | times: 0.01 }},
      shipping: {{ shipping_price | times: 0.01 }},
      currency: checkout.total_price_set.presentment_money.currency_code,
      items: [
       {% for line_item in line_items %}{
        item_id: "{{ line_item.product_id }}",
        item_name: "{{ line_item.title | remove: "'" | remove: '"' }}",
        currency: checkout.total_price_set.presentment_money.currency_code,
        price: {{ line_item.final_price | times: 0.01 }},
        quantity: {{ line_item.quantity }}
      },{% endfor %}
 ]
  }
});
{% endif %}
</script>
  <!-- Google Tag Manager -->
  <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
  j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  })(window,document,'script','dataLayer','GTM-TAG_CODE');</script>
  <!-- End Google Tag Manager -->

 

gruff
Tourist
27 0 2

Got the code to work. Got the code to work. The correct Shopify variable format is below:

 

transaction_id: '{{ order_id }}',
currency: '{{ currency }}',

 

The only issue is that the '{{ order_id }}' is not pulling back the actual order Id. Seems to be pulling back a different code. Looking to pull back the Order ID which has the # prefix. Does anyone know any different shopify variables to use for the Order ID?