Zen Cart Logo
Forums / Basic Configuration / i wanna install facebook pixel into my website

i wanna install facebook pixel into my website

Views: 2,097

Results 1 to 5 of 5
6 Apr 2016, 2:09 AM
#1
juneloweelyn avatar

juneloweelyn

New Zenner

Join Date:
Jan 2009
Posts:
70
Plugin Contributions:
0

i wanna install facebook pixel into my website

i wanna install facebook pixel into m website

i am asked to
Copy the code below and paste it between the <head> and </head> in your website code. The pixel will track visits to every page of your website.

My Question

  1. which file should i install it? since that i need to put in every page of my website
  2. can i put in JS script?
  3. i tried putting in JS script, however, it doesnt work , possible because i also copy <script> </script> into the js file?
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');

fbq('init', 'NUMBER');
fbq('track', "PageView");</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=NUMBER&ev=PageView&noscript=1"
/></noscript>
<!-- End Facebook Pixel Code -->
6 Apr 2016, 4:12 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: i wanna install facebook pixel into my website

Make a copy for your template structure of /includes/templates/template_default/common/html_header.php
Insert your code just before the </head> tag

// DEBUG: echo '<!-- I SEE cat: ' . $current_category_id . ' || vs cpath: ' . $cPath . ' || page: ' . $current_page . ' || template: ' . $current_template . ' || main = ' . ($this_is_home_page ? 'YES' : 'NO') . ' -->';


?>

Insert your code here
</head>
<?php // NOTE: Blank line following is intended: ?>
6 Apr 2016, 1:38 PM
#3
juneloweelyn avatar

juneloweelyn

New Zenner

Join Date:
Jan 2009
Posts:
70
Plugin Contributions:
0

Re: i wanna install facebook pixel into my website

Thanks so much! i should try that and let u know the outcome! thank you!

9 Apr 2016, 5:01 AM
#4
juneloweelyn avatar

juneloweelyn

New Zenner

Join Date:
Jan 2009
Posts:
70
Plugin Contributions:
0

Re: i wanna install facebook pixel into my website

if i have my own templates , can i know is it i need to go to change this specific file in my own template instead?

/includes/templates/MYTEMPLATE/common/html_header.php

10 Apr 2016, 10:21 AM
#5
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: i wanna install facebook pixel into my website

change this specific file in my own template instead
Yes, and wht I stated that you should make a copy for your template

If you already have one in your template then edit that one

One should NEVER edit the files in template_default