ohsembuy Posted October 3, 2016 Share Posted October 3, 2016 Greeting to cubecart's team and cubecarters, I'm one of the co-owners of http://ohsembuy.com and we'd decided to use Facebook ads to boost up our webstore's sales. After I setup an ads in Facebook, its required me to add the "Facebook Pixel Helper" code into my webstore's code, as shown at below: <!-- 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', '105319869934614'); fbq('track', 'PageView'); </script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=105319869934614&ev=PageView&noscript=1" /></noscript> <!-- DO NOT MODIFY --> <!-- End Facebook Pixel Code --> I would be highly appreciated, if any expert can show me the ways to overcome this matter. Thanks in advanced, Simon Wilson. Quote Link to comment Share on other sites More sharing options...
Noodleman Posted October 3, 2016 Share Posted October 3, 2016 overcome what matter? you've not asked a question I assume you want to know how to install it? if so, you can add that code into your store skin "main.php" file. You will want to wrap the code in literal tags {literal} YOUR CODE {/literal} once in place, clear your store cache and you can use the chrome extension "facebook pixel helper" to validate it is working. If the code is for the purpose of conversion tracking, you may need to add it into your content.receipt.php skin file. Quote Link to comment Share on other sites More sharing options...
ohsembuy Posted October 4, 2016 Author Share Posted October 4, 2016 12 hours ago, Noodleman said: overcome what matter? you've not asked a question I assume you want to know how to install it? if so, you can add that code into your store skin "main.php" file. You will want to wrap the code in literal tags {literal} YOUR CODE {/literal} once in place, clear your store cache and you can use the chrome extension "facebook pixel helper" to validate it is working. If the code is for the purpose of conversion tracking, you may need to add it into your content.receipt.php skin file. Hi Noodleman, Thank you very much for your prompt reply. Yup, that's what I meant - I got a few questions here (Sorry, as I'm still a newbie in cubecart, hope you don't mind :)) 1. Is "index.php" file same with "main.php" file? It's because, I only found "index.php" file inside instead of "main.php" file. 2. I tried to find "content.receipt.php" inside the "Skins" folder, but I couldn't find it. Do I need create a new "content.receipt.php" file and manually upload it onto cpanel? Looking forward for your reply and thanks again. Quote Link to comment Share on other sites More sharing options...
bsmither Posted October 4, 2016 Share Posted October 4, 2016 1. In reference to main.php, please know that the programmers chose to name the skin template files with a .php suffix, though there is no technical reason to give the template file names any specific naming syntax at all. The template rendering engine (Smarty) will use whatever the name was given to use. The templates are in /skins/SKIN_NAME/templates/. 2. As above. Quote Link to comment Share on other sites More sharing options...
Noodleman Posted October 4, 2016 Share Posted October 4, 2016 6 hours ago, ohsembuy said: Hi Noodleman, Thank you very much for your prompt reply. Yup, that's what I meant - I got a few questions here (Sorry, as I'm still a newbie in cubecart, hope you don't mind :)) 1. Is "index.php" file same with "main.php" file? It's because, I only found "index.php" file inside instead of "main.php" file. 2. I tried to find "content.receipt.php" inside the "Skins" folder, but I couldn't find it. Do I need create a new "content.receipt.php" file and manually upload it onto cpanel? Looking forward for your reply and thanks again. Good Morning, Can you confirm what skin you are using for your store? You can check this within the admin area "Store Settings --> Layout". This will tell us the name of the directory in which your store skin sits on your server. It can be found in the /skins/<YOUR SKIN> directory, with <YOUR SKIN> being whatever skin you are using. Within the skin directory you will find a "templates" folder. These are the files that control the layout of your theme and within this directory you should find the "main.php" file. In theory the files can be named anything, so knowing which skin you are using will be helpful. Are you following a guide on how to add the pixel to your store? If so, can you share the link to the guide you are following? Quote Link to comment Share on other sites More sharing options...
ohsembuy Posted October 5, 2016 Author Share Posted October 5, 2016 On 10/4/2016 at 9:52 AM, bsmither said: 1. In reference to main.php, please know that the programmers chose to name the skin template files with a .php suffix, though there is no technical reason to give the template file names any specific naming syntax at all. The template rendering engine (Smarty) will use whatever the name was given to use. The templates are in /skins/SKIN_NAME/templates/. 2. As above. Hi bsmither, Thanks for your explanation, I will try to figure out the templates. Quote Link to comment Share on other sites More sharing options...
ohsembuy Posted October 5, 2016 Author Share Posted October 5, 2016 21 hours ago, Noodleman said: Quote Good Morning, Can you confirm what skin you are using for your store? You can check this within the admin area "Store Settings --> Layout". This will tell us the name of the directory in which your store skin sits on your server. It can be found in the /skins/<YOUR SKIN> directory, with <YOUR SKIN> being whatever skin you are using. Within the skin directory you will find a "templates" folder. These are the files that control the layout of your theme and within this directory you should find the "main.php" file. In theory the files can be named anything, so knowing which skin you are using will be helpful. Are you following a guide on how to add the pixel to your store? If so, can you share the link to the guide you are following? Hi Noodleman, I've checked the skin and apparently it's the "Foundation>Default" skin. The "/skins/foundation/templates/main.php" - I think I found it Yup, that's a guide to add Facebook Pixel Helper: https://www.facebook.com/business/help/218844828315224 One more thing, is there any recommendation for me to edit .php file online? I might need it, so that I can edit and re-upload the "main.php + content.receipt.php" files. Thanks again buddy. Quote Link to comment Share on other sites More sharing options...
bsmither Posted October 5, 2016 Share Posted October 5, 2016 "Is there any recommendation for me to edit .php file online?" Depending on the type of hosting provider you have, they may give you a hosting "control panel". There are a few types - the one I have seen the most is called Cpanel. Regardless, within the control panel are a number of tools. One such tool is a File Explorer. With this, you find the file you want to manage - including to edit. Somewhere in the File Manager tool, once the file is highlighted, you should find an "Edit" button. Then, depending on the sophistication of the editor, the code might be shown with typical code coloring. If an editor is not available in your control panel, or you do not have a control panel, then there are a few programmer's text editors available with the key feature of being able to fetch and save files via FTP - free and retail. An internet search for text editor ftp support gives a number of possibilities. (Personally, I use UltraEdit.) Quote Link to comment Share on other sites More sharing options...
ohsembuy Posted October 6, 2016 Author Share Posted October 6, 2016 21 hours ago, bsmither said: "Is there any recommendation for me to edit .php file online?" Depending on the type of hosting provider you have, they may give you a hosting "control panel". There are a few types - the one I have seen the most is called Cpanel. Regardless, within the control panel are a number of tools. One such tool is a File Explorer. With this, you find the file you want to manage - including to edit. Somewhere in the File Manager tool, once the file is highlighted, you should find an "Edit" button. Then, depending on the sophistication of the editor, the code might be shown with typical code coloring. If an editor is not available in your control panel, or you do not have a control panel, then there are a few programmer's text editors available with the key feature of being able to fetch and save files via FTP - free and retail. An internet search for text editor ftp support gives a number of possibilities. (Personally, I use UltraEdit.) Glad to know it and thanks for your explanation, bsmither. Unfortunately, I didn't see any "File explorer" tool inside my hosting cpanel. Though, I will use UltraEdit to edit those php files. Quote Link to comment Share on other sites More sharing options...
ohsembuy Posted October 6, 2016 Author Share Posted October 6, 2016 Hmm, I'm still having trouble, after I copied and pasted the Facebook Pixel Helper onto the main.php file. My website just turned into blank page, without showing anything - http://ohsembuy.com Facebook Pixel Helper's ads placement: http://prnt.sc/cqedr5 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Here's the code for the main.php file: {* * CubeCart v6 * ======================================== * CubeCart is a registered trade mark of CubeCart Limited * Copyright CubeCart Limited 2015. All rights reserved. * UK Private Limited Company No. 5323904 * ======================================== * Web: http://www.cubecart.com * Email: [email protected] * License: GPL-3.0 https://www.gnu.org/licenses/quick-guide-gplv3.html *} <!DOCTYPE html> <html class="no-js" xmlns="http://www.w3.org/1999/xhtml" dir="{$TEXT_DIRECTION}" lang="{$HTML_LANG}"> <head> <title>{$META_TITLE}</title> <meta charset="{$CHARACTER_SET}"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="{$CANONICAL}" rel="canonical"> <link href="{$STORE_URL}/favicon.ico" rel="shortcut icon" type="image/x-icon"> <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/normalize.css" rel="stylesheet"> <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/foundation.css" rel="stylesheet"> <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/font-awesome/css/font-awesome.min.css" rel="stylesheet"> <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/cubecart.css" rel="stylesheet"> <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/cubecart.common.css" rel="stylesheet"> <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/cubecart.helpers.css" rel="stylesheet"> {if !empty($SKIN_SUBSET)} <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/cubecart.{$SKIN_SUBSET}.css" rel="stylesheet"> {/if} <link href="{$STORE_URL}/skins/{$SKIN_FOLDER}/css/jquery.bxslider.css" rel="stylesheet"> <link href="//fonts.googleapis.com/css?family=Open+Sans:400,700" rel="stylesheet" type='text/css'> {foreach from=$CSS key=css_keys item=css_files} <link href="{$STORE_URL}/{$css_files}" rel="stylesheet" type="text/css" media="screen"> {/foreach} <meta http-equiv="Content-Type" content="text/html;charset={$CHARACTER_SET}"> <meta name="description" content="{if isset($META_DESCRIPTION)}{$META_DESCRIPTION}{/if}"> <meta name="keywords" content="{if isset($META_KEYWORDS)}{$META_KEYWORDS}{/if}"> <meta name="robots" content="index, follow"> <meta name="generator" content="cubecart"> {if $FBOG} <meta property="og:image" content="{$PRODUCT.thumbnail}"> <meta property="og:url" content="{$VAL_SELF}"> {/if} {include file='templates/content.recaptcha.head.php'} <script src="{$STORE_URL}/skins/{$SKIN_FOLDER}/js/vendor/modernizr.min.js"></script> <script src="{$STORE_URL}/skins/{$SKIN_FOLDER}/js/vendor/jquery.js"></script> {include file='templates/element.google_analytics.php'} {foreach from=$HEAD_JS item=js}{$js}{/foreach} <!-- 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', '105319869934614'); fbq('track', 'PageView'); </script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=105319869934614&ev=PageView&noscript=1" /></noscript> <!-- DO NOT MODIFY --> <!-- End Facebook Pixel Code --> </head> <body> The red color code is the one I inserted. However, once I inserted it, the website just turned into a completely blank page. Is there any solution for this problem? Thanks in advanced. PS: The above Facebook's ads is for the: Website Conversions Get people to take valuable actions on your website, such as watching a demo or purchasing a product. Use the Facebook pixel to measure and optimise adverts for conversions. Quote Link to comment Share on other sites More sharing options...
Noodleman Posted October 6, 2016 Share Posted October 6, 2016 I think you missed the {literal} tags I mentioned. Here is a direct copy/paste of pixel code from one of my customers sites. I've simply changed the init ID. You can copy/paste this code into your main.php file, and then replace the init ID with your own ID <!-- Facebook Pixel Code --> {literal} <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','//connect.facebook.net/en_US/fbevents.js'); fbq('init', 'XXXXXXXXXXXXXXXXXXXXXXXX'); fbq('track', "PageView");</script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=XXXXXXXXXXXXXXXXXXXXXXXXXX&ev=PageView&noscript=1" /></noscript> {/literal} <!-- End Facebook Pixel Code --> Quote Link to comment Share on other sites More sharing options...
ohsembuy Posted October 7, 2016 Author Share Posted October 7, 2016 20 hours ago, Noodleman said: I think you missed the {literal} tags I mentioned. Here is a direct copy/paste of pixel code from one of my customers sites. I've simply changed the init ID. You can copy/paste this code into your main.php file, and then replace the init ID with your own ID <!-- Facebook Pixel Code --> {literal} <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','//connect.facebook.net/en_US/fbevents.js'); fbq('init', 'XXXXXXXXXXXXXXXXXXXXXXXX'); fbq('track', "PageView");</script> <noscript><img height="1" width="1" style="display:none" src="https://www.facebook.com/tr?id=XXXXXXXXXXXXXXXXXXXXXXXXXX&ev=PageView&noscript=1" /></noscript> {/literal} <!-- End Facebook Pixel Code --> Hi noodleman, Woah, that's amazing! Thanks a million for your awesome suggestion here. I owed you one, if you need anything else, you can kindly PM me anytime you want. Quote Link to comment Share on other sites More sharing options...
artas Posted November 16, 2016 Share Posted November 16, 2016 Thanks for all script work very well, here ... / public_html / skins / *your_name* skins / templates / main.php Facebook code insert here <head> ... {literal} Facebook script {/literal} </head> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.