Google Tag Manager
An updated version of this doc can be seen here. It is assuming you are setting up GTM to use Facebook pixels but you can use GTM for any script or css you can think of.
Google Tag Manager is a free service provided by Google that allows you to manage all of your tags (retargeting, analytics, conversion codes, etc) in one easy place. It is "vendor neutral" which means that it can accept code from any source such as Facebook or your CRM. Setup is a bit tricky, but you only have to do it once.
First thing you have to do is set up a Google Analytics account up (it's free).
You will need to paste that code into the site settings page as seen below.
Hit the save button.
Now you need to export your container. Do that by clicking the "Export Container" link under the Google Tag Manager Container ID Box as shown below.
Save that file and remember where you saved it (it is named google_tag_manager_container.json by default). Now that you have this, you need to set up an account in Google Tag Manager. To get started, CLICK HERE and sign up for an account (again, it's free). It will ask you to name your account and set up a "container." You can simply name the container the same as your domain name. On "Where to use Container" select Web (see below)
Accept the Terms of Service.
Google Tag Manager will provide you with a block of code that looks like this:
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id= GTM-XXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s),
<!-- End Google Tag Manager -->
I have bolded 2 section above inside the code. Those two sections will have the same series of numbers and/or letters. That is your Container ID. You need to copy those characters (not the entire code, just that part) over into your Google Tag Manager Container ID section on the Site Settings page of your site. (Just click that link to go directly there and scroll down.) Make sure to include the GTM- part of the code. Make sure to hit "Update info" once you have added it.
Go back to Google Tag Manager and you should see this screen:
Click on the "Admin" button that the arrow is pointing to in the image above. Next click on Import Container as shown below.
Import the container that you downloaded earlier (it was named google_tag_manager_container.json by default if you need to search for it). Use the "Overwrite" option when importing and press continue. **If you get an error saying "containerVersion.tag.vendorTemplate.parameter.trackingId: The value must not be empty." this means that you didn't put in your Google Analytics code before you exported the container. Go back and do that, export it again, and then come back and import it again.
Hit confirm. This should bring you back to this page:
Under the "New Tag" section, click on Add a new tag. It will ask you to choose a product. For Facebook tags, you will need to select "Custom HTML Tag" and click on Continue.
You will now get a box where you can paste your Facebook retargeting or tracking pixel (that you get from Facebook). It will look like the following:
For A General Tracking Pixel
For A Conversion Tracking Pixel
Notice that I have added the fbq('track', 'Lead') part here. This is from Facebook, although Facebook doesn't explain it very well at all.
Once you have pasted that there, click continue.
It will ask you where you want the code to "fire" (i.e. be displayed), as shown below. You need to click on the "MORE" button.
After clicking on the MORE tab, this is what you will see:
In order to put something on EVERY PAGE (for example, a retargeting pixel), you will need to select "HVL Pageview Trigger"
In order to put something just on the page after lead submits email address (i.e. a conversion pixel), you would select HVL Completed Lead Trigger (there are a couple of them)
In order to put something just on the report page, you would select HVL Report Page.
You can create one tag for retargeting and another for conversion tracking if you desire.
Click on Save, then go to the upper right hand corner and hit the Publish button.
Unfortunately, because Google Tag Manager is account specific, we are unable to create tags and containers for you. The information on this page is the only support that we can provide for Google Tag Manager.