How-To: Add Facebook Tracking pixel code to your Branding Template
  • 23 Nov 2023
  • 1 minute read
  • Dark
    Light
  • PDF

How-To: Add Facebook Tracking pixel code to your Branding Template

  • Dark
    Light
  • PDF

Article summary

You can include your Facebook Pixel Code script in your Slate branding template by going to the 'shared' folder in the File Editor. Find the main build xslt file of the branding template. 

Click on the /shared/build.xslt to pop up the 'Edit File' view.

Find the tag near the top of the file (highlighted in the sample screenshot) and place your FB pixel code just above the closing tag. In the example below, this would be above line 20 (the contents inside the will vary from template to template - just concentrate on finding the closing tag).

mceclip0.png

mceclip2.png

Copy the code you received from your Facebook installation instructions or your Marketing folks, and paste the full script into the file. You will see something like this:

mceclip1.png

Note the code highlight (in the example above on line 38). If you attempt to save this file, you will encounter a browser error stating something like "'=' is an unexpected token. The expected token is ';'. Line 38, position 55.".

The Slate-based file editor is expecting valid XHTML code. Some characters are reserved in HTML; the '&' character is one of them. Character entities are used to display reserved characters in HTML. In the original script '&' merely needs to be properly escaped using the proper HTML entity code '&'

mceclip2.png

Once properly escaped, you can save the file (at the bottom of the pop-up window). 

mceclip5.png


For more information on the Facebook tracking pixel and the default version of the script see: https://www.facebook.com/business/help/952192354843755?id=1205376682832142.

 


Was this article helpful?

What's Next