The steps below walk through installing the Facebook pixel base code in your content settings and the Facebook event code on your pages.
1. Install the Facebook pixel base code
- In your HubSpot Marketing account, navigate to Content > Content Settings.
- Scroll to the Site Header HTML section and paste the Facebook pixel base code. Do not include the <nonscript> portion of the pixel code here.
- In the Site Footer HTML section, paste the <nonscript> portion of the pixel code.
Please note: the <nonscript> section at the end of your Facebook pixel code must be pasted into the footer HTML to avoid invalid HTML from being generated on the page.
- Click Save changes at the bottom.
- Once the code has been added, check that your pixel is working by navigating to the Pixels tab in your Facebook Ads Manager, then clicking Send Test Traffic. If your status reads Active, your base code has been installed correctly. This can take several minutes to update.
2. Install the Facebook event code on your page
- In your HubSpot Marketing account, navigate to Content > Landing Pages or Website Pages.
- Locate and hover over the page in the dashboard and click Edit. The Facebook event code should be added to the final page of your offer, which is usually your thank you page.
- Click the Settings tab and scroll down to Advanced Options, then click Edit Footer HTML.
- Paste the Facebook event code in the dialog box that appears, then click Save changes.
- Click Update or Publish in the upper right corner of the page editor.
Please note: in most instances, this code will conflict with other code on your page when added to the Head HTML. In order for it to fire correctly, please be sure to add the Facebook event code to the Footer HTML.