英文:
GA4 and Shopify Revenue Discrepancy
问题
终于在stackoverflow上了,之前一直遇到无法匹配GA4分析和Shopify收入的问题。首先,我已经使用GTM集成了Shopify和GA4。我创建了自定义事件并按照要求提取数据。我还安装了适用于Shopify的Google和YouTube应用,并与相同的GA4帐户集成,结果发现GA4中的收入是Shopify内置分析报告中的两倍,这让我认为是应用程序使收入翻倍了。因此,我断开了应用与当前GA4的连接,结果收入相对较低。
示例
2023年8月6日的收入
Shopify:4023 AED
GA4:7200 AED
2023年8月8日的收入(断开Google应用程序-Shopify后)
Shopify:4073 AED
GA4:483 AED
> GA4与Shopify的集成方式如下:
- 在theme.liquid的head部分实施GTM标签
<script>
window.dataLayer = window.dataLayer || [];
</script>
<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-XXXXXXX');</script>
- 在theme.liquid的body部分实施GTM标签
- Shopify设置->附加脚本->以下代码块
<script>
window.dataLayer = window.dataLayer || [];
</script>
<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-XXXXXXX');</script>
<script>
products = [];
{% for line_item in checkout.line_items %}
products.push({
'currency' : '{{ shop.currency }}',
'item_id' : {{ line_item.product_id | json }},
'item_sku' : {{ line_item.sku | json }},
'item_variant_id' : {{ line_item.variant_id | json }},
'item_name' : {{ line_item.title | json }},
'item_brand' : {{shop.name | json}},
'item_category' : {{ line_item.product.type | json }},
'price' : {{ line_item.price | amount_without_currency | remove: "," | json }}/100.0,
'quantity' : {{ line_item.quantity | json }}
});
{% endfor %}
transaction_data = {
'transaction_id' : {{ checkout.order_number | json }},
'affiliation' : {{ shop.name | json }},
'value' : {{ checkout.total_price | amount_without_currency | remove: "," | remove: "." | json }}/100.0,
'tax' : {{ checkout.tax_price | amount_without_currency | remove: "," | remove: "." | json }}/100.0,
'shipping' : {{ checkout.shipping_price | amount_without_currency | remove: "," | remove: "." | json }}/100.0,
'subtotal' : {{ checkout.subtotal_price | amount_without_currency | remove: "," | remove: "." | json }}/100.0,
'coupon': '{{checkout.discounts[0].code}}',
'discount': {{checkout.discounts_amount | amount_without_currency | remove: "," | remove: "." | json }}/100.0,
'currency': '{{ shop.currency }}',
'payment_type': '{{checkout.transactions.gateway}}',
'items': products
};
user_data = {
'full_name' : {{ checkout.shipping_address.name | json }},
'first_name' : {{ checkout.shipping_address.first_name | json }},
'last_name' : {{ checkout.shipping_address.last_name | json }},
'address1' : {{ checkout.shipping_address.address1 | json }},
'address2' : {{ checkout.shipping_address.address2 | json }},
'street' : {{ checkout.shipping_address.street | json }},
'city' : {{ checkout.shipping_address.city | json }},
'province' : {{ checkout.shipping_address.province | json }},
'zip' : {{ checkout.shipping_address.zip | json }},
'country' : {{ checkout.shipping_address.country | json }},
'phone' : {{ checkout.shipping_address.phone | json }},
'email' : {{ checkout.email | json }}
};
</script>
{% if first_time_accessed %}
<script>
dataLayer.push({
'event' : 'purchase',
'pageType' : 'nur_purchase',
'ecommerce' : transaction_data,
'user' : user_data
});
</script>
{% endif %}
- GA应用已断开连接,如下图所示:
可以提供更多信息,真正导致数据收入下降的原因是什么?
英文:
Finally on stackoverflow after having endless problems with matching GA4 analytics and Shopify revenue. First off -
I have integrated shopify and GA4 with GTM. I have created custom events and pulling the data as per. I also have installed Google & Youtube Application for Shopify and integrated with the exact GA4 account and it seemed the revenue is doubled up in GA4 compared to shopify in built analytic report which led me to think its the application which doubles up the revenue. So I disconnected the app from my current GA4 which turns comparatively low in revenue.
EXAMPLE
Revenue in numbers on 06 AUG 2023
Shopify: 4023 AED
GA4: 7200 AED
Revenue in numbers on 08 AUG 2023 (after disconnecting Google App - Shopify)
Shopify: 4073 AED
GA4: 483 AED
> How GA4 is integrated with shopify is
-
Implementing GTM tag on head on theme.liquid
<script> window.dataLayer = window.dataLayer || []; </script> <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-XXXXXXX');</script>
-
Implementing GTM tag on body on theme.liquid
-
Shopify settings -> additional script -> below code block
<script> window.dataLayer = window.dataLayer || []; </script> <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-XXXXXXX');</script> <script> products = []; {% for line_item in checkout.line_items %} products.push({ 'currency' : '{{ shop.currency }}', 'item_id' : {{ line_item.product_id | json }}, 'item_sku' : {{ line_item.sku | json }}, 'item_variant_id' : {{ line_item.variant_id | json }}, 'item_name' : {{ line_item.title | json }}, 'item_brand' : {{shop.name | json}}, 'item_category' : {{ line_item.product.type | json }}, 'price' : {{ line_item.price | amount_without_currency | remove: "," | json }}/100.0, 'quantity' : {{ line_item.quantity | json }} }); {% endfor %} transaction_data = { 'transaction_id' : {{ checkout.order_number | json }}, 'affiliation' : {{ shop.name | json }}, 'value' : {{ checkout.total_price | amount_without_currency | remove: "," | remove: "." | json }}/100.0, 'tax' : {{ checkout.tax_price | amount_without_currency | remove: "," | remove: "." | json }}/100.0, 'shipping' : {{ checkout.shipping_price | amount_without_currency | remove: "," | remove: "." | json }}/100.0, 'subtotal' : {{ checkout.subtotal_price | amount_without_currency | remove: "," | remove: "." | json }}/100.0, 'coupon': '{{checkout.discounts[0].code}}', 'discount': {{checkout.discounts_amount | amount_without_currency | remove: "," | remove: "." | json }}/100.0, 'currency': '{{ shop.currency }}', 'payment_type': '{{checkout.transactions.gateway}}', 'items': products }; user_data = { 'full_name' : {{ checkout.shipping_address.name | json }}, 'first_name' : {{ checkout.shipping_address.first_name | json }}, 'last_name' : {{ checkout.shipping_address.last_name | json }}, 'address1' : {{ checkout.shipping_address.address1 | json }}, 'address2' : {{ checkout.shipping_address.address2 | json }}, 'street' : {{ checkout.shipping_address.street | json }}, 'city' : {{ checkout.shipping_address.city | json }}, 'province' : {{ checkout.shipping_address.province | json }}, 'zip' : {{ checkout.shipping_address.zip | json }}, 'country' : {{ checkout.shipping_address.country | json }}, 'phone' : {{ checkout.shipping_address.phone | json }}, 'email' : {{ checkout.email | json }} }; </script> {% if first_time_accessed %} <script> dataLayer.push({ 'event' : 'purchase', 'pageType' : 'nur_purchase', 'ecommerce' : transaction_data, 'user' : user_data }); </script> {% endif %}
-
GA app is disconnected as below picture
More info can be provided, what can really cause the issue in lowering data revenue?
答案1
得分: 0
通过卸载 Shopify 的 Google 应用程序来解决问题-防止数字冲突,并且只需在 theme.liquid 的 head 部分和用于结账的电子商务跟踪的自定义脚本上保留 gtm 脚本-> 还有一些其他的脚本,这些脚本在上面已经包含了。当然,Shopify 在线商店和 GA4 之间会有一些数字上的差异,因为它不是100%准确的。
英文:
it is solved by uninstalling google app for shopify - prevents number conflicts and just keeping gtm script on head on theme.liquid and on custom script for ecommerce tracking on checkout -> additional scripts which was included above. of course there will be a few number is going to be different from shopify online store to ga4 since its not 100% accurate.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论