SEO, AdWords, affiliates, advertising, and promotions
Hi,
Tried to setup a Google Shopping campaign and the Conversion Action Purchase has a tracking status of "Inactive".
I have the google & youtube app installed which is showing the Conversion tracking as being correct.
Unsure what else I need to be doing or checking. Any ideas?
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 %}
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 -->
@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?? 🙄
All Google GTAG tracking is hosted on the website URL googletagmanager.com But has nothing to do with the platform GTM.
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>
Most of the way there. Went with Google Tag manager over Google Tag.
Carried out the following steps:
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:
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 -->
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?
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.
If you are using the Google and Youtube app for conversion tracking, then GTM is not used. So the second screenshot is irrelevant.
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 -->
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?
Hi Gruff,
Regarding the Conversion Action Purchase tracking, the status will become active after you have a few organic sales or customers.
For the other issues you’re experiencing, I recommend trying a different application for Google Ads tracking. I’ve been using the Infinite Google Ads Conversion Tracking app for the past 8 months, and the results have been outstanding. It provides 100% accurate tracking, resolving many of the issues I previously encountered.
If you’re looking for reliable and precise conversion tracking, this app is definitely worth a try.
And if you want a free conversion action option for pixels, I have built my own tracking script. You just need to manually install it.
read the whole thread, and I guess you have found your solution (courtesy to Emmanuel) and others.
and as Nimra pointed out, in case you want to go with a different app, while also skipping all the manual theme file changes, then I will recommend Nabu for Google Ads Pixel.
Starts at free, and offers 1-click installation of the google ads conversion pixel, with many other features.
Aniruddha Jethmalani | Content Writer @ AdNabu
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- Try our Nabu for Google Shopping Feed App from Shopify App Store.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024