2

I am asked to add a Facebook pixel for the

fbq('track', 'Lead');

Standard event. And I can't figure out which file is this that I need to put the code in it. Any help would be appreciated. Thank you in advance

3 Answers 3

1

There are a few different ways of adding that kind of code to every page on a 1.9 site. One way to do this is in the admin:

System > Config > General > Design > HTML Head > Miscellaneous Scripts 

This works great in most cases and the only thing you have to pay attention to is the Current Configuration Scope setting in the upper left of the admin. This sets the store view, so if you have multiple stores (like different languages or companies' sites using the same inventory) you need to make sure that this little code is on all these different view by switching between them.

The one issue here is that some tracking codes are very picky about where they are placed on the page. The instructions for the code will tell you this, but i often see "place the tracking code directly before the closing tag" blah blah blah. If that is the case, there are a few templates that are used on every page of the site. If you are using the RWD theme:

app/design/frontend/rwd/default/template/page/1column.phtml
app/design/frontend/rwd/default/template/page/2columns-left.phtml
app/design/frontend/rwd/default/template/page/2columns-right.phtml
app/design/frontend/rwd/default/template/page/3columns.phtml
app/design/frontend/rwd/default/template/page/empty.phtml

Copy these files over to your theme using that same path structure and you can place the code directly where is needs to be.

There is a 3rd more complex way of doing this involving the use of the $this->getChildHtml() method, but there is a lot to cover there, so i'll only go into it if the other methods don't work.

0

Usually u put pixel code in header and config it in fb in 1.9 usually u can do this under the admin under additional scripts

0

You can add both code at same page, one at header and second event code at from where you want to track clicker.

Your Answer

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

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