We recommend use the Google Site Kit plugin to set up and manage your Google Analytics tracking.
Important: after adding a new method for tracking, always clear your cache.
Jump to:
Site Kit Plugin
We recommend using Google's Site Kit Plugin to add Google Analytics & GA4 tracking.
See this Nerdpress tutorial for the site kit plugin.
Pagespeed optimization
We highly recommend everyone have WP Rocket for pagespeeed purposes.
Make sure you have WP Rocket > File Optimization > Load Javascript Deferred > enabled
You'll want to add the following to your WP Rocket > Preload > Prefetch DNS Requests
//google-analytics.com
//www.google-analytics.com
//ssl.google-analytics.com
Filtering FBCLID
A number of services add tracking parameters to outbound links, including Google Adwords, Facebook, and newsletter. Even the "Customize" screen generates unique URLs that clutter up your Google Analytics.
Go to Google Analytics > Admin > View > View Settings > Exclude URL Query Parameters
Here's a starting list that you'll want to expand on: gclid,epik,fbclid,customize_changeset_uuid
Enable Site Search Tracking
You'll want to enable site search tracking to see what your visitors are looking for once they land on your site:
Optimizing with Google Analytics
This post on optimizing your site with Google Analytics from Tom Crowe Digital has some good tips.
GDPR violation
According to a recent ruling from the French data protection authority (CNIL), Google Analytics violates GDPR regulations and should not be served to European citizens.
At this time we're unaware of any solution which automatically excludes European users.
Troubleshooting
If you need further troubleshooting, we recommend hiring Alison at Digital-ade.