Adding Analytics
Why use analytics?
Most professional website teams using Gatsby use one of three types of analytics services on their website:
- Google Analytics because the functionality is free and comprehensive.
- Third-party marketing analytics like marketing automation (Hubspot, Marketo), session recording (FullStory, Heap), or hundreds of smaller vendors
- Google Tag Manager or Segment in order to easily send data to these third-party services, or collect data with third-party scripts
Gatsby offers a plugin for most common services, making first-class integration of analytics a simple, speedy, and secure process.
When utilizing marketing analytics tools, one key tradeoff is that marketing analytics tools are often the culprit for poor website performance. As a result, tools that make it easier for marketers to add and remove analytics (via Google Tag Manager), can also make it easier for them to harm site performance without noticing.
Adding scripts performantly
Gatsby has a built-in Gatsby Script Component that aids in loading scripts performantly. It offers a convenient way to declare different loading strategies, and a default loading strategy that gives Gatsby users strong performance out of the box.
Guides to common analytics tools
Other Gatsby analytics plugins
- Amplitude Analytics
- Fathom
- Baidu
- Matomo (formerly Piwik)
- Simple Analytics
- Parse.ly Analytics
- GoatCounter
- PostHog
- Plausible
- Vercel