1.0.4 • Published 5 years ago

gatsby-plugin-gtag-outbound v1.0.4

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

gatsby-plugin-gtag-outbound

Add Google Analytics gtag.js to a site with Outbound linking

Does the same thing as gatsby-plugin-google-analytics, but instead of adding deprecated analytics.js script, it uses gtag.js. Includes Outbound Link module.

Install

npm install --save gatsby-plugin-gtag-outbound

Use

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-plugin-gtag-outbound`,
      options: {
        // your google analytics tracking id
        trackingId: `UA-XXXXXXXX-X`,
        // Puts tracking script in the head instead of the body
        head: false,
        // enable ip anonymization
        anonymize: true,
      },
    },
  ],
}

Outbound Links

import { OutboundLink } from 'gatsby-plugin-gtag-outbound'

Use like any other anchor tag in your component: <OutboundLink href='yourwebsite.example' />

Options

head

Puts tracking script in the head instead of the body. Default is false (render in the body)

anonymize

Adds anonymize_ip flag when calling gtag. More info here.

License

MIT

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago