A number of web platforms platforms such as Facebook, YouTube, or Hubspot provide services that let you monitor site users' browsing habits in order to better deliver the information that users are looking for. This monitoring is usually done via "tracking code," short snippets of programming that you can copy from a website like Facebook or Hubspot and paste onto your own site pages. The pages on your site where tracking codes are pasted determine what sort of information you can glean about site usage patterns.
To add a tracking code to your site, start by going to the service or platform whose tracking code you want to use. Often these sites will have dedicated pages that deliver a unique snippet of code for you to use on your own site. Copy this tracking code to your clipboard, then follow these instructions for placing the code in the appropriate location(s) on your own site. Please be aware that while root file access is not possible, there are often alternatives, such as using Meta tags in the Head section.
All tracking codes are not created equal! Depending on how the code is written, it may need to be placed in a very specific location on your own pages. The site where you obtain the tracking code will usually tell you where exactly to paste the code on your site; this article includes instructions for placing tracking code in:
- The <head> tags of individual site pages (This is where Meta tags go)
- Before the close of the <body> tag on individual site pages
- All site pages
For all locations:
Every type of tracking code is added either to the Page Layout or a Banner. To find the name of the banner or layout associated with a given page, select the page within Page Manager and scroll to the bottom, then check the Page Banners and Layout section:
Next, navigate to the Design tab, located under Site Management:
To add code to the <head> tag:
If your code needs to placed inside the <head> tag, you'll need to add it to the Page Layout. Keep in mind that this will put the code on all pages that use that layout! If you only want the code to apply to a single page, clone the layout, and assign it to the page in question before adding the code.
Select “Page Layouts” From the Site Manager > Design menu, and add the code to the "Script and Style Code" content box. Do not modify any other code.
If there’s already content in the “Script and Style Code” area, that’s fine. Just hit Enter a few times to give yourself a couple lines of white space, and paste the tracking code in right alongside whatever code is already there.
Don't forget to save and publish the Page Layout once you've added the code.
To add code to the <body> tag:
Code that needs to be as close to the <body> tag (that is, the opening body tag, near the top of the document) as possible must go into a Top Banner.
Code that needs to go as close to the </body> tag (the close body tag near the end of the document) as possible must go into a Bottom Banner.
The procedure is the same in either case.
You'll want to add the code to the </> (HTML) section of the banner.
You can either add a new text element to the banner, or use one that already exists. Add the code by clicking the </> icon, and pasting the code into that section. Save and publish the banner when finished.