1

I am trying to add facebook pixel code in particular category.How can i add that js file in magento please help me.

  • 1
    please mention your magento version and come more detail your questions – Rama Chandran M Jul 4 '17 at 14:13
1

1.) create a template file with you FB pixel code and put it into

app/design/frontend/THEME/PACKAGE/template/your_file.phtml

2.) add a block to layout with your modules layout.xml or local.xml in

app/design/frontend/THEME/PACKAGE/layout/

<CATEGORY_{id}>
    <reference name="before_body_end">
        <block type="core/template" name="fb.pixel">
            <action method="setTemplate">
                <template>your_file.phtml</template>
            </action>
        </block>
    </reference>
</CATEGORY_{id}>

Or

You can do the same from backend ... "Admin - Catalog - Manage Categories" and paste code from above (without <CATEGORY_{id}>) into categories "Custom Layout Update" section.


See your other questions belongs to Magento2 ... this is for M1, but it should work similiar there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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