Skip to content

Commit

Permalink
Update adding-analytics.md (#27624)
Browse files Browse the repository at this point in the history
  • Loading branch information
im-adithya authored Nov 3, 2020
1 parent a6bebe4 commit 216d1d8
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions docs/docs/adding-analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,28 @@ You should now have a Tracking ID; take note of it, as your website will need to

You can find this tracking ID later by going to `Admin > Tracking Info > Tracking Code`.

## Using `gatsby-plugin-gtag`
## Using `gatsby-plugin-google-gtag`

Now, it's time to configure Gatsby to send page views to your Google Analytics account.

We are going to use `gatsby-plugin-gtag`. For other analytics options (including Google Tag Manager), check [other Gatsby analytics plugins](#other-gatsby-analytics-plugins).
We are going to use `gatsby-plugin-google-gtag`. For other analytics options (including Google Tag Manager), check [other Gatsby analytics plugins](#other-gatsby-analytics-plugins).

```shell
npm install gatsby-plugin-gtag
npm install gatsby-plugin-google-gtag
```

```js:title=gatsby-config.js
module.exports = {
plugins: [
{
resolve: `gatsby-plugin-gtag`,
resolve: `gatsby-plugin-google-gtag`,
options: {
// replace `UA-XXXXXXXXX-X` with your own Google Analytics Tracking ID
trackingId: `UA-XXXXXXXX-X`,
// You can add multiple tracking ids and a pageview event will be fired for all of them.
trackingIds: [
"GA-TRACKING_ID", // Google Analytics / GA
"AW-CONVERSION_ID", // Google Ads / Adwords / AW
"DC-FLOODIGHT_ID", // Marketing Platform advertising products (Display & Video 360, Search Ads 360, and Campaign Manager)
],
},
},
],
Expand All @@ -52,7 +56,7 @@ module.exports = {

> Note: Read more about [gatsby-config.js](/docs/gatsby-config/)
Full documentation for the plugin can be found [here](/packages/gatsby-plugin-gtag/).
Full documentation for the plugin can be found [here](/packages/gatsby-plugin-google-gtag/).

There are a number of extra configuration options--both with the Gatsby plugin and also in your Google Analytics account--so you can tailor things to meet your website's needs.

Expand Down

0 comments on commit 216d1d8

Please sign in to comment.