BEFORE YOU BEGIN: If youâ€™re alreadyÂ tracking your website using an olderÂ tracking snippet, first remove the older snippet. You can use a text or HTML editor on the file that contains the snippet and save it if you have customizations you want to add back in later. (Looking for the traditional snippet?Â See this article.)
Hereâ€™s how to add theÂ asynchronous snippet to your site:
- Find theÂ asynchronous snippet for your profile
TheÂ tracking code is profile-specific, so you can only access it from theÂ Profile Settings screen for that profile. Go toÂ Analytics Settings and click â€œEditâ€ next to the profile used for your site. In theÂ Profile Settings page, click the â€œCheck Statusâ€ link. Youâ€™ll see something similar to thecode snippet below, whereÂ
XXXXX-YYindicates the profile ID for yourÂ Analytics account.
- Copy and place theÂ code snippet
Once you find theÂ code snippet, copy and paste it into your web page,Â just before the closing
</head>tag*. If your website uses templates to generate pages, enter it just before the closingÂ
</head>tag in the file that contains theÂ
<head>section. (Most websites re-use one file for common content, so itâ€™s likely that you wonâ€™t have to place theÂ code snippet on every single page of your website.)For the best performance across all browsers we suggest you position other scripts in your site in one of these ways:
- before theÂ tracking code snippet in the <head> section of your HTML
- after both theÂ tracking code snippet and all page content (e.g. at the bottom of the HTML body)
- Verify and customize
Verify that yourÂ tracking code contains the correct web property ID for your profile (it should if you copied it from theÂ Profile Settings screen). Double-check that theÂ tracking snippet installed on your website matches theÂ code shown in the profile. For more details on verifying your setup, see Verify your setup.
Add any customizations back in using theÂ asynchronous syntax. TheÂ Usage Guide andÂ Migration Examples (English only) onÂ Google Code provide many examples of customizations withasynchronous tracking.
<head> section, and we recommend placing the snippet at the bottom of theÂ
<head> section for best performance.