Google Analytics

Setup Google Analytics on your website.

Install

Google Analytics is available as a third-party Gatsby plugin.

npm install --save gatsby-plugin-google-analytics

Setup

// gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-google-analytics`,
options: {
// The property ID; the tracking code won't be generated without it
trackingId: 'YOUR_GOOGLE_ANALYTICS_TRACKING_ID',
},
},
],
}

Additional options are available on gatsby-plugin-google-analytics documentation.