All things Shopify and commerce
I am really sick of this problem I am trying to fix this problem sins a month but I can't, my TikTok pixel is not tracking my ads to cart or purchases and when I try to test events it doesn't work either and when I go to my web site to see if the TikTok pixel helper tracking my website right I don't see any results either, and I already got in touch with Shopify and TikTok support but they couldn't help me either.
I will be so grateful if I get any help from you and thanks.
( i already checked if I connected my TikTok pixel right and if the pixel is the right one )
my website name: kitchenthingsstore.com
<script>
!function (w, d, t) {
w.TiktokAnalyticsObject = t; var ttq = w[t] = w[t] || []; ttq.methods = ["page", "track", "identify", "instances", "debug", "on", "off", "once", "ready", "alias", "group", "enableCookie", "disableCookie"], ttq.setAndDefer = function (t, e) { t[e] = function () { t.push([e].concat(Array.prototype.slice.call(arguments, 0))) } }; for (var i = 0; i < ttq.methods.length; i++)ttq.setAndDefer(ttq, ttq.methods[i]); ttq.instance = function (t) { for (var e = ttq._i[t] || [], n = 0; n < ttq.methods.length; n++)ttq.setAndDefer(e, ttq.methods[n]); return e }, ttq.load = function (e, n) { var i = "https://analytics.tiktok.com/i18n/pixel/events.js"; ttq._i = ttq._i || {}, ttq._i[e] = [], ttq._i[e]._u = i, ttq._t = ttq._t || {}, ttq._t[e] = +new Date, ttq._o = ttq._o || {}, ttq._o[e] = n || {}; var o = document.createElement("script"); o.type = "text/javascript", o.async = !0, o.src=i + "?sdkid=" + e + "&lib=" + t; var a = document.getElementsByTagName("script")[0]; a.parentNode.insertBefore(o, a) };
//pixel ID
ttq.load('YOUR PIXEL HERE ');
}(window, document, 'ttq');
window.addEventListener('DOMContentLoaded', () => {
{% if request.page_type == 'product' %}
ttq.track('ViewContent')
{% else %}
ttq.page();
{% endif %}
document.querySelectorAll('button[name="checkout"]').forEach(btn => {
btn.addEventListener("click", () => {
console.log('checkout')
ttq.track('InitiateCheckout')
})
})
})
</script>
This is the only code on the web available that works perfectly, thanks @Mike1974. For those who stop by, enter the code below on your checkout page (shopify-url-store/admin/settings/checkout) to track the complete payment event for 1 or more products:
-------------------------------------
Esse é o único código na web disponível que funciona perfeitamente, obrigado @Mike1974 . Aproveitando para quem passar por aqui, insira o código abaixo também na sua página de checkout (shopify-url-store/admin/settings/checkout) para acompanhar o evento de pagamento completo de 1 ou mais produtos:
<script>
!function (w, d, t) {
w.TiktokAnalyticsObject=t;var ttq=w[t]=w[t]||[];ttq.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"],ttq.setAndDefer=function(t,e){t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}};for(var i=0;i<ttq.methods.length;i++)ttq.setAndDefer(ttq,ttq.methods[i]);ttq.instance=function(t){for(var e=ttq._i[t]||[],n=0;n<ttq.methods.length;n++)ttq.setAndDefer(e,ttq.methods[n]);return e},ttq.load=function(e,n){var i="https://analytics.tiktok.com/i18n/pixel/events.js";ttq._i=ttq._i||{},ttq._i[e]=[],ttq._i[e]._u=i,ttq._t=ttq._t||{},ttq._t[e]=+new Date,ttq._o=ttq._o||{},ttq._o[e]=n||{};var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=i+"?sdkid="+e+"&lib="+t;var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)};
ttq.load('YOUR PIXEL ID TIKTOK HERE');
ttq.page();
ttq.track('CompletePayment', {
contents: [
{% for line_item in line_items %}
{
content_id: '{{line_item.product_id}}',
quantity: {{line_item.quantity}},
price: {{line_item.line_price | times: 0.01}},
},
{% endfor %}],
value: {{ total_price }} / 100,
currency: '{{ checkout.currency }}',
});
}
(window, document, 'ttq');
</script>
im having the same issue..will this code track the View content as well? Also i assume this code has to be entered in the section below the code i have already for my FB?
@RHF Yes, in below your code, BUT I recommend you to use the official TikTok app to Shopify to add your tag: https://apps.shopify.com/tiktok
TikTok App Shopify Store (is free)
Is very simple to use and works perfectly.
TIP: if you want to check everything with your pixel, select to collect the maximum information from your users in TikTok app configurations.
hi,
Thanks for the response..my issue is with the tiktok app on shopify its saying that its not connected even though i checked in the shopify app and its connected.. when using the tiktok helper chrome extension it says that there is no pixel ..i had run my first campaign day before adn it spent money fine for a day and then i started getting these errors so im not sure what to do and titktok support has still not got back to me
The code has been applied, still no pixel detected at the url + no attributed events. What would you recommend I try next?
can I use this even if I installed the pixel using the Shopify app?
You must use only ONE WAY to enter the TikTok Pixel in your store, if you use more than one way, it will cause duplicate pixel conflict. I suggest using the official app I mentioned in the previous post.
What is the virtual address (URL) of your store?
The code has been applied, still no pixel detected at the url + no attributed events. What would you recommend I try next?
Hi,
did you find a solution for this?
I tried adding the code to the checkout page but still no conversion tracking...
Hi, try to use the official app, works for me:
https://apps.shopify.com/tiktok
did you find a fix, im facing the same problem
Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025