What are some Analytics Best Practices?
Best Practices
Only include an analytics script in your output type if it will be used globally across every page of your website.
Consider early on how to handle turning your analytics off for user that opt-out. We recommend creating a new notrack output type where users can be redirected to when they opt out.
Include analytics that are specific to a component in the componentDidMount section of that component. For example, video analytic scripts are only loaded when there is a video player on the page.
Consider if your analytics is AMP compatible and how that will affect the AMP version of your site if you have one.
Always use a minified version of your analytics scripts.
Load your analytics scripts from a CDN if possible.
We recommend you keep your original analytics configuration as much as possible unless there are necessary performance improvements or a specific problem you are attempting to address. Post launch, if you want to change your configurations, you will have a proper baseline to work with.
Common Problems
Here is a list of some of the common problems we see when clients implement their analytics in Arc:
Loading of unnecessary analytics scripts, they are included but the functionality is never used on your site.
Loading multiple versions of a script. For example, you include jQuery version 3.4.1 and then your analytics script loads jQuery version 2.2.4.
The analytics are packaged with other third party functionality. This means when you include your analytics scripts you are also getting other, unused third party code.
Common Analytics in Comparison
Type | Easy to Implement | AMP Compatible | GDPR Compatible |
---|---|---|---|
Google Analytics | Yes | Yes | Yes |
Chartbeat | Yes | Yes | Yes |
Tag Commander | Yes | No | Yes |