Web tracking code serves to collect visitor data from any website and place it into Google Analytics where it can be viewed in reports. The tool is useful in identifying which audience visits your site, what purchases are being made on that site and viewing a visitor’s behavior across primary and sub-domains. Before setting up web tracking code, it is important to remove any older tracking snippets before adding a new one. Also, make sure you have set up an Analytics Account for the site and have already added your site as a property to the account you are using. After taking these precautions, follow the steps below:
1. Find the tracking code snippet for your property
From any page, click ‘Admin’ and select the property you would like to track. Make sure to check that the URL at the top matches the URL for your site. Next, click the ‘Tracking Info’ tab. From there, you will see something that looks similar to the snippet of code below, where ‘XXXXX-Y’ is the property ID.
2. Turn on your desired tracking options and click ‘Save’
3. Copy and place the code snippet into your web page
Make sure to paste the code snippet into your web page just before closing the </head> tag. It is recommended to place the snippet at the bottom of the <head> section for best performance. For the best performance across all browsers, position other scripts in your site either before the tracking code snippet in the <head> section of your HTML or at the bottom of the HTML body.
4. Verify the tracking code and add customizations
It is important to verify that your tracking code contains the correct web ID for your profile. Also, check that the tracking snipped on your website matches the code from the profile. Lastly, add any customizations back in using the asynchronous syntax.