{"id":20790614,"url":"https://github.com/ryanashcraft/gatsby-plugin-amplitude-analytics","last_synced_at":"2025-08-22T03:18:04.444Z","repository":{"id":32636982,"uuid":"138534253","full_name":"ryanashcraft/gatsby-plugin-amplitude-analytics","owner":"ryanashcraft","description":"Gatsby plugin to add Amplitude analytics onto a site","archived":false,"fork":false,"pushed_at":"2023-01-06T01:43:19.000Z","size":196,"stargazers_count":4,"open_issues_count":10,"forks_count":11,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-25T16:09:10.959Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanashcraft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-25T02:30:39.000Z","updated_at":"2021-05-18T02:24:28.000Z","dependencies_parsed_at":"2023-01-14T22:00:31.997Z","dependency_job_id":null,"html_url":"https://github.com/ryanashcraft/gatsby-plugin-amplitude-analytics","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanashcraft%2Fgatsby-plugin-amplitude-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanashcraft%2Fgatsby-plugin-amplitude-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanashcraft%2Fgatsby-plugin-amplitude-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanashcraft%2Fgatsby-plugin-amplitude-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanashcraft","download_url":"https://codeload.github.com/ryanashcraft/gatsby-plugin-amplitude-analytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252575801,"owners_count":21770628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T15:36:10.146Z","updated_at":"2025-05-05T20:49:50.594Z","avatar_url":"https://github.com/ryanashcraft.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gatsby-plugin-amplitude-analytics\n\nEasily add Amplitude Analytics to your Gatsby site. Automatically tracks page views and outbound link clicks.\n\n## Install\n\n`yarn add gatsby-plugin-amplitude-analytics`\n\nor\n\n`npm install --save gatsby-plugin-amplitude-analytics`\n\n## How to use\n\n```javascript\n// In your gatsby-config.js\nmodule.exports = {\n  plugins: [\n    {\n      resolve: `gatsby-plugin-amplitude-analytics`,\n      options: {\n        // Specify the API key for your Amplitude Project (required)\n        apiKey: \"YOUR_AMPLITUDE_ANALYTICS_API_KEY\",\n        // Puts tracking script in the head instead of the body (optional)\n        head: false,\n        // Prevents loading Amplitude and logging events if visitors have \"Do Not Track\" enabled (optional)\n        respectDNT: true,\n        // Avoids sending pageview hits from custom paths (optional)\n        exclude: [\"/preview/**\", \"/do-not-track/me/too/\"],\n        // Override the default event types (optional)\n        eventTypes: {\n          outboundLinkClick: 'OUTBOUND_LINK_CLICK',\n          pageView: 'PAGE_VIEW',\n        },\n        // Amplitude JS SDK configuration options (optional)\n        amplitudeConfig: {\n          saveEvents: true,\n          includeUtm: true,\n          includeReferrer: true\n        },\n        // Specify NODE_ENVs in which the plugin should be loaded (optional)\n        environments: [\"production\"],\n      },\n    },\n  ],\n}\n```\n\n## `\u003cOutboundLink\u003e` component\n\nTo make it easy to track clicks on outbound links in Amplitude Analytics,\nthe plugin provides a component.\n\nTo use it, simply import it and use it like you would the `\u003ca\u003e` element. For example:\n\n```jsx\nimport React;\nimport { OutboundLink } from 'gatsby-plugin-amplitude-analytics';\n\nexport default () =\u003e {\n  \u003cdiv\u003e\n    \u003cOutboundLink\n      href=\"https://www.gatsbyjs.org/packages/gatsby-plugin-amplitude-analytics/\"\n    \u003e\n      Visit the Amplitude Analytics plugin page!\n    \u003c/OutboundLink\u003e\n  \u003c/div\u003e\n};\n```\n\n## The \"respectDNT\" option\n\nIf you enable this optional option, Amplitude Analytics will not be loaded at all for visitors that have \"Do Not Track\" enabled. While using Amplitude Analytics does not necessarily constitute Tracking, you might still want to do this to cater to more privacy oriented users.\n\n## The \"exclude\" option\n\nIf you need to exclude any path from the tracking system, you can add it (one or more) to this optional array as glob expressions.\n\n## The \"eventTypes\" option\n\nTo override the default event types that are used for page event and outbound link clicks, include this option. The value should be a map with two keys: \"outboundLinkClick\", and \"pageView\". For example:\n\nThe default values for these events are \"outbound link click\" and \"page view\".\n\n## The \"amplitudeConfig\" option\n\nConfiguration settings passed to the `amplitude.getInstance().init()` call. This option allows you to enable automatic collection of UTM params and referrer info and change persistence and upload behavior. See https://developers.amplitude.com/docs/advanced-settings for a full list of available options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanashcraft%2Fgatsby-plugin-amplitude-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanashcraft%2Fgatsby-plugin-amplitude-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanashcraft%2Fgatsby-plugin-amplitude-analytics/lists"}