Add GA and Facebook Pixel in Google Tag Manager
Before we start, if you have not implemented your Google Tag Manager, check out my previous article How to implement Google Tage Manager (GTM) first. If you have done so, let’s get started.
Add Google Pageview tracking tag
- Login to your Google Tag Manager.
- In your Workspace, click on the “Add a new tag”.
- Give a proper name for your tag. I will name is GA – Pageview – All Pages. This tag will track pageview on my site.
- Click on the Tag Configuration section.
- Under Featured and select the first option “Google Analytics: Universal Analytics”
- For Track Type, select Pageview.
- For Google Analytics Settings, select New Variable.
- Give a name for the Variable, I used my Google Analytics ID as the name. Under Tracking ID, also paste your Google Analytics ID in the field. After that click Save.
Login to your Google Analytics Account to find your ID or you can check my earlier post on How to setup Google Analytics for your website to set up an account or how to find in Google Analytics.
- Now click on the Triggering section.
- Select All Pages
- Once everything is done, click the Save button.
- Now click Submit.
- Give a proper version name and description so you know what changes you have made. Then click Publish and GTM will activate the new changes.
Add Facebook Pixel code into Google Tag Manager
- Go to your dashboard and click “Add a new tag”.
- Give it a proper name. I name it “Facebook Pixel – Pageview – All pages. After that click on the Tag Configuration.
- There is no Facebook Tag type so we have to use a “Custom HTML” tag. Select Custom HTML tag.
- Paste the Facebook Pixel code into the box. If you do not have a Facebook Pixel code, you can read my previous article “What is Facebook Pixel and how to set it up” to see how you can generate one for your website.
- Click on the triggering section.
- Select “All pages”.
- Click “Save”.
- Click “Submit”.
- Give it a version name and description and click “Publish”.
That it, you have successfully added Google Analytics tracking code and Facebook Pixel code into Google Tag Manager.