Using Facebook pixel with Google Tag Manager

30/11/2019

If you're using Google Tag Manager to manage tags for your website, you can add your Facebook pixel to your Google Tag Manager account to measure and optimise the results of your Facebook advertising. Learn about the benefits of installing the Facebook pixel.

Install your pixel

  1. Log in to your Google Tag Manager account.
  2. Select your website's container and click Add a new tag.
  3. Click Custom HTML tag and enter a name for your tag.
  4. Go to Events Manager and click Details for your pixel.
  5. Click Set up and select Manually install the code yourself.
  6. Copy the entire pixel base code, as shown below.
  7. Return to Google Tag Manager and paste the code in the HTML container.
  8. Click the Advanced settings drop-down and select Once per page under Tag firing options.
  9. Under Fire on, select All pages.
  10. Click Create tag.

Create action-specific tags

Now that you have your base code installed, you can create specific tags for the different types of pages and events on your website (e.g. product page, Add to Basket button, purchase page).

  1. In Google Tag Manager, select your website's container and click Add a new tag.
  2. Name your tag, then insert just the snippet of code relating to that event, plus any other variables you want to track. Bear in mind that your variables (e.g. product_ids and product_name) may be different from the example below.
  3. Click Custom HTML tag and enter a name for your tag.
  4. Copy and paste the snippet of code relating to the event and any other variables that you want to track. Bear in mind that your variables (e.g. product_ids and product_name) may be different from the example below.
  5. Under Advanced settings, select Once per event under Tag firing options.
  6. Under Tag sequencing, tick the box and select your base code tag to ensure this tag fires after your base code.
  7. Under Fire on, select the trigger that is relevant for your site.
  8. Click Create tag.
  9. In the same way, create tags for the other events on your website (e.g. add to basket, purchase). See the examples below.
  10. When you've finished creating tags, click Publish.

Check if your pixel is working

Once you've uploaded all your events, you should check if your pixel is working correctly. To check that your pixel is working properly on your live site:

  1. Navigate to the web page that your pixel was added to. If it's working, your pixel detail page in Events Manager will show your pixel's status as Active and you'll see activity reported in the dashboards. Learn more about your pixel data in Events Manager.
  2. If your pixel's status is No activity yet, you can use the Facebook Pixel Helper to troubleshoot the problem. Once the Pixel Helper is installed in your Chrome browser, a small icon will appear next to your address bar. Navigate to your website in your Chrome browser and click the Pixel Helper icon. You can see which pixel events were found on the page and whether they have loaded successfully, or see troubleshooting tips if there are any issues. Learn more.
Once you've successfully set up your pixel, learn how to run ads on Facebook using conversion optimisation.

* Nguồn: Facebook