0

My client has asked me to install Facebook pixel on there Magento 1 website. What I have received from them are the four text file 1. Add to Cart Pixel.txt 2. Initiate Checkout Pixel.txt 3. Page View Pixel.txt 4. Purchase Pixel.txt

The code inside AddTocart is

<script>
fbq('track', 'AddToCart', {
value: 1,
currency: 'USD',
});
</script>

Similar in other files also.

I have no idea how to proceed further. Where to add this code?

Can anyone suggest me on this further step?

Thanks in advance..!

1 Answer 1

0

You can use this module to fulfill your requirements. https://marketplace.magento.com/cadence-cadence-fbpixel.html

This will be help full for you to load script for particular pages.

for cart page, you can use this

  1. Go to app/design/frontend/{package}/{theme}/layout/local.xml then add this :

    <checkout_cart_index>
        <reference name="head">
            <action method="addItem"><type>skin_js</type><name>js/my-custom.js</name></action>
        </reference>
    </checkout_cart_index>
    

2.Create your new js file in: skin/frontend/{package}/{theme}/js/my-custom.js then put your code inside.

  1. Now your js file will be just loaded in checkout/cart. Don't forget to clear the cache.

If you want to add js in the head of checkout page then use below code

<checkout_onepage_index translate="label">
          <reference name="head">
               <action method="addJs"><script>product_designer/checkout_image.js</script></action>
          </reference>
</checkout_onepage_index>
8
  • i have recived this from my client, cant ask them to install this now. I have to work on what they have given to me
    – Nafsss
    Mar 4, 2020 at 6:15
  • Then you need to put it's on a particular file and need to override core files.if you install this module in your site then it will be helpful for you Mar 4, 2020 at 6:19
  • Go to app/design/frontend/{package}/{theme}/layout/local.xml then add this : <checkout_cart_index> <reference name="head"> <action method="addItem"><type>skin_js</type><name>js/my-custom.js</name></action> </reference> </checkout_cart_index> Create your new js file in: skin/frontend/{package}/{theme}/js/my-custom.js then put your code inside. Now your js file will be just loaded in checkout/cart. Don't forget to clear the cache. Mar 4, 2020 at 6:34
  • What about other 3 pages? Can u tell me about that also plz
    – Nafsss
    Mar 4, 2020 at 6:40
  • please help. I am still stuck
    – Nafsss
    Mar 4, 2020 at 7:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.