You can use Google Analytics to track visitors on your website. You can see what pages they are landing on, where they are navigating to, and when they leave. It can be invaluable knowledge to have when assessing your site.
If you have a WordPress site, see our How to Add Google Analytics to a WordPress Site article.
Set Up Google Analytics
The first step is to set up the analytics on the Google end and get the tracking ID.
- Sign in or create a Google Analytics account
- In the left bottom of the sidebar, click Admin
- On the right side of the screen, select the account you would like to use or create a new account by clicking the + Create Account button
- Click the + Create Property button
- Select Website
- Enter the following information:
- Website Name: The name you will use to identify your site
- Website URL: The website’s URL
- Industry Category: The type of industry that the website falls under
- Reporting Time Zone: This will determine the time displayed in analytics results
- Click the Get Tracking ID button
- Copy the code on the next page, under the Global Site Tag header
You will need this code for the next step.
Add Analytics to Your Site
Next, you need to go to your website files. Find the <head> tag on each of your web pages and add the code you copied in the previous section.
The code will look like this, but with your own tracking ID substituted.
<!-- Global Site Tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=TRACKING_ID"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'TRACKING_ID'); </script>
Once you have added the tracking code, you can test to see if it’s working by visiting the live site, then looking at the REAL-TIME page in the analytics interface. If working, it should show that a visitor is viewing the page.