how to add visit tracking code on each product page

how to add visit tracking code on each product page

sethkeshav92
Tourist
5 0 0

I m using an affiliate platform voluum

this platform give a visit trackking script to be added to each product page of any website platform

but i dont know how and wher to put it in shopify panel

we were able to add it to product pages of php website properly and it works as well

but here in shopify i m not sure

 

@suyash1 can you help here as well

like in https://community.shopify.com/c/shopify-design/adding-tracking-script-to-every-page/m-p/972725

 

script from voluum

<meta http-equiv="delegate-ch" content="sec-ch-ua https://resuestedformotels.com; sec-ch-ua-mobile https://resuestedformotels.com; sec-ch-ua-arch https://resuestedformotels.com; sec-ch-ua-model https://resuestedformotels.com; sec-ch-ua-platform https://resuestedformotels.com; sec-ch-ua-platform-version https://resuestedformotels.com; sec-ch-ua-bitness https://resuestedformotels.com; sec-ch-ua-full-version-list https://resuestedformotels.com; sec-ch-ua-full-version https://resuestedformotels.com"><style>.dtpcnt{opacity: 0;}</style>
<script>
(function(c,a,f,q,b,m,r,g,h,k,d,n,e,p){p="https:"===c.location.protocol?"secure; ":"";c[b]||(c[b]=function(a){c[b].state.callbackQueue.push(a)},c[b].state={callbackQueue:[]},c[b].registerConversion=function(a){c[b].state.callbackQueue.push(a)},function(){(k=/[?&]cpid(=([^&#]*)|&|#|$)/.exec(c.location.href))&&k[2]&&(d=k[2],n=a.cookie.match(new RegExp("(^| )vl-"+d+"=([^;]+)")));var b=a.cookie.match(/(^| )vl-cid=([^;]+)/),l;"savedCid"!==r||!b||d&&"undefined"!==typeof d||(l=b.pop());g=a.createElement("script");
h=a.scripts[0];g.src=m+(-1===m.indexOf("?")?"?":"&")+"oref="+f(a.referrer)+"&ourl="+f(location[q])+"&opt="+f(a.title)+"&vtm="+(new Date).getTime()+(l?"&cid="+l:"")+(n?"&uw=no":"");h.parentNode.insertBefore(g,h);d&&(e=new Date,e.setTime(e.getTime()+864E5),a.cookie="vl-"+d+"=1; "+p+"samesite=Strict; expires="+e.toGMTString()+"; path=/")}())})(window,document,encodeURIComponent,"href","dtpCallback","https://resuestedformotels.com/d/.js","savedCid");
</script>
<noscript><link href="https://resuestedformotels.com/d/.js?noscript=true&ourl=" rel="stylesheet"/></noscript>

Replies 7 (7)

suyash1
Shopify Partner
10719 1324 1700

@sethkeshav92 - put this code before </head> in you theme.liquid file and check

Support me | To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com , My timezone is GMT+5:30.

sethkeshav92
Tourist
5 0 0

@suyash1 

thanks I just copy pasted this code in a test store I created just to seee where the code should be added and then tried to access store link but visit didnt get recorded

 

1- dircetly copy pasted - didnt work

2- copied, pasted line by linethinking some error with formatting

 

can you suggest further

Cedcommerce
Shopify Partner
718 77 116

Hello @sethkeshav92

 

You need to run the below script on the product page if want to track the visitors on the product page.

 

Simply paste the code under the condition that it will run only on your product page:-

 

Here is your code with the condition:-

 

{% if template.name contains "product" %}

   <meta http-equiv="delegate-ch" content="sec-ch-ua https://resuestedformotels.com; sec-ch-ua-mobile https://resuestedformotels.com; sec-ch-ua-arch https://resuestedformotels.com; sec-ch-ua-model https://resuestedformotels.com; sec-ch-ua-platform https://resuestedformotels.com; sec-ch-ua-platform-version https://resuestedformotels.com; sec-ch-ua-bitness https://resuestedformotels.com; sec-ch-ua-full-version-list https://resuestedformotels.com; sec-ch-ua-full-version https://resuestedformotels.com">

 

   <style>.dtpcnt{opacity: 0;}</style>

 

   <script>

       (function(c,a,f,q,b,m,r,g,h,k,d,n,e,p){p="https:"===c.location.protocol?"secure; ":"";c[b]||(c[b]=function(a)    {c[b].state.callbackQueue.push(a)},c[b].state={callbackQueue:[]},c[b].registerConversion=function(a){c[b].state.callbackQueue.push(a)},function(){(k=/[?&]cpid(=([^&#]*)|&|#|$)/.exec(c.location.href))&&k[2]&&(d=k[2],n=a.cookie.match(new RegExp("(^| )vl-"+d+"=([^;]+)")));var b=a.cookie.match(/(^| )vl-cid=([^;]+)/),l;"savedCid"!==r||!b||d&&"undefined"!==typeof d||(l=b.pop());g=a.createElement("script");

h=a.scripts[0];g.src=m+(-1===m.indexOf("?")?"?":"&")+"oref="+f(a.referrer)+"&ourl="+f(location[q])+"&opt="+f(a.title)+"&vtm="+(new Date).getTime()+(l?"&cid="+l:"")+(n?"&uw=no":"");h.parentNode.insertBefore(g,h);d&&(e=new Date,e.setTime(e.getTime()+864E5),a.cookie="vl-"+d+"=1; "+p+"samesite=Strict; expires="+e.toGMTString()+"; path=/")}())})(window,document,encodeURIComponent,"href","dtpCallback","https://resuestedformotels.com/d/.js","savedCid");

   </script>

 

   <noscript><link href="https://resuestedformotels.com/d/.js?noscript=true&ourl=" rel="stylesheet"/></noscript>

 

{% endif %}

 

Hope this helps, let us know if you need any further help.

 

All the best, 

CedCommerce

CedCommerce || Shopify Expert
- Let us know if our reply is helpful for you. Like it.
- Was your question answered? Mark it as an accepted solution.
- For further discussion contact: Email ID- apps@cedcommerce.com
- Whatsapp:- Join Here
sethkeshav92
Tourist
5 0 0

Thank you, I'll check it now and get back with an update

sethkeshav92
Tourist
5 0 0

no luck with this

 

just tried after copy pasting code from line 247 to 261

suyash1
Shopify Partner
10719 1324 1700

@sethkeshav92 - add code before </head> , and check if you get any error in console section of browser, many times other javascript conflicts do not allow it to work

Support me | To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com , My timezone is GMT+5:30.
sethkeshav92
Tourist
5 0 0

yes 2 errors showing up

 

kindly look into the attached ppt