Google Analytics is one of the primary tools for tracking user behavior on your site.
Step 1 - Get Your Google Analytics Tracking ID
To get Google Analytics set up on your site, first create a Google Analytics account and walk through the steps till you get your Tracking ID number.
This looks something like this: UA-163673633-7
If you already have a Google Analytics account, you can find your tracking ID by clicking on Admin > Property Settings.
Step 2 - Install the GA Google Analytics Plugin
There are several WordPress plugins that enable Google Analytics tracking on your sites. We recommend the simple and popular GA Google Analytics.
Many of these plugins add dashboards in your WordPress admin that require calls to 3rd party APIs that Strattic's HTTP Authentication will block. So we recommend using a simple Google Analytics plugin to add tracking functionality and the Google Analytics dashboard for viewing your analytics data.
Once you install and activate GA Google Analytics, go to Settings > Google Analytics and click on the "Plugin Settings" header.
You can then add your Tracking ID from Step 1.
Also, select "Global Site Tag" as the Tracking Method and save the changes.
Step 3 - Test Google Analytics is Tracking
Finally, we want to test that everything works. Click "Strattic Publish" to update your live static site.
Then open your Google Analytics Dashboard. You will see a widget in blue called "Active Users right now." Note the number.
Then view your updated live static site and after a few moments you should see the number of Active Users go up by one.
This shows you everything is working properly.