Google Analytics Tracking Code in HTML: Where to Put It


Mon. Jul. 08, 2019 2:00pm

I’ll show you where to place a Google Analytics code in an HTML page and how to test if it worked.

Lastly, let’s take a look how to install Google Analytics code on HTML page. I’ll use cPanel’s file manager, but you can also use an FTP software like FileZilla. Most hosting providers have cPanel so you should be good.

1. Im now in my cPanel dashboard.
2. Just click on File Manager
3. And then locate your html file
4. Then right click on the file and choose “edit”.
5. Here we have an HTML code for simple page, just find the closing head tag, like this one.
6. Then switch back to the tab with analytics
7. And copy the whole code snippet.
8. And paste it just above head closing tag.
9. Let me make it a bit easier to read by selecting the whole thing and pressing tab few times.
10. And don’t forget to save the file here at the top.

11. Now, go back to Analytics and press on “Send test traffic”. Or you can open an incognito window with your website.
12. After few sections it should show that there is one active user on your website right now.

Now keep in mind, what you have now is default installation of GA, it’s pretty good for most people but for example, if you have an e-commerce website it’s better that you setup enhance e-commerce. So you can track your revenue and orders in Google Analytics. A video for enchanced ecommerce will appear on your screen now.

My website setup recommendations:

Support the channel:
on Amazon:
PayPal tip jar: