{"id":18905022,"url":"https://github.com/coreyward/gatsby-plugin-segment-analytics","last_synced_at":"2025-04-15T04:11:18.246Z","repository":{"id":34148904,"uuid":"170555335","full_name":"coreyward/gatsby-plugin-segment-analytics","owner":"coreyward","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-18T20:48:37.000Z","size":292,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-22T15:43:39.901Z","etag":null,"topics":["gatsby","gatsby-plugin","segment-analytics","segmentio"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coreyward.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-13T18:09:40.000Z","updated_at":"2024-06-18T20:48:41.000Z","dependencies_parsed_at":"2024-11-08T09:10:16.346Z","dependency_job_id":"4342fae6-60fa-44e3-9c09-56a7e67552d9","html_url":"https://github.com/coreyward/gatsby-plugin-segment-analytics","commit_stats":{"total_commits":32,"total_committers":4,"mean_commits":8.0,"dds":0.5,"last_synced_commit":"d1ff16e781b4f38cf67b9ac22088934ed86bf6b2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyward%2Fgatsby-plugin-segment-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyward%2Fgatsby-plugin-segment-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyward%2Fgatsby-plugin-segment-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyward%2Fgatsby-plugin-segment-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coreyward","download_url":"https://codeload.github.com/coreyward/gatsby-plugin-segment-analytics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249003949,"owners_count":21196793,"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":["gatsby","gatsby-plugin","segment-analytics","segmentio"],"created_at":"2024-11-08T09:10:13.921Z","updated_at":"2025-04-15T04:11:18.230Z","avatar_url":"https://github.com/coreyward.png","language":"JavaScript","readme":"# gatsby-plugin-segment-analytics\n\nA [Gatsby](https://www.gatsbyjs.org) plugin to add\n[Segment’s](https://segment.com/) Analytics.js integration.\n\nThis is designed to work with Gatsby versions ≥ 2.0.0.\n\n## Installation\n\nInstall with yarn...\n\n```sh\nyarn add gatsby-plugin-segment-analytics\n```\n\nor NPM...\n\n```sh\nnpm i gatsby-plugin-segment-analytics\n```\n\n### Configure\n\nIn your `gatsby-config.js`, add the `gatsby-plugin-segment-analytics` plugin and\nprovide your Segment Analytics.js write key as an option:\n\n```js\nmodule.exports = {\n  plugins: [\n    {\n      resolve: \"gatsby-plugin-segment-analytics\",\n      options: {\n        writeKey: \"YOUR WRITE KEY\",\n\n        // Optional page name to send with page events; not set by default\n        eventName: \"YOUR PAGE EVENT NAME\",\n      },\n    },\n  ],\n}\n```\n\n## Usage\n\nThe latest version of the Segment tracking snippet will automatically be\ngenerated and injected into the `\u003chead\u003e` of your layout using Gatsby's SSR API\nhooks. When a page is loaded, and Gatsby's `onRouteUpdate` API is called,\n`analytics.page` will be fired.\n\nIn development, `window.analytics` is a shim that simply logs calls to the\nconsole rather than sending noise to Segment.\n\n### Outbound Link Tracking\n\nTo make it easy to track clicks on outbound links, this plugin provides an\n`OutboundLink` component similar to the one provided by\n[gatsby-plugin-google-analytics](https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-google-analytics#outboundlink-component).\n\nTo use it, simply import it and use it like you would the `\u003ca\u003e` element e.g.\n\n```js\nimport React\nimport { OutboundLink } from \"gatsby-plugin-segment-analytics\"\n\nexport default () =\u003e {\n\n  \u003cdiv\u003e\n    \u003cOutboundLink\n      href=\"https://www.gatsbyjs.org/packages/gatsby-plugin-segment-analytics/\"\n    \u003e\n      Visit the Segment Analytics plugin page!\n    \u003c/OutboundLink\u003e\n  \u003c/div\u003e\n}\n```\n\nYou can optionally provide an `eventName` and `categoryName` prop to\nOutboundLink. This will change the segment event name (which is defaulted to\n\"Click\"), and the category name (which is a property of the segment event),\nrespectively. More information on the segment page event can be found\n[here](https://segment.com/docs/connections/spec/page/)\n\n```js\n\u003cOutboundLink\n  href=\"https://www.gatsbyjs.org/packages/gatsby-plugin-segment-analytics/\"\n  eventName=\"Visit External Link\"\n  categoryName=\"Gatsby Resource\"\n\u003e\n  Visit the Segment Analytics plugin page!\n\u003c/OutboundLink\u003e\n```\n\n## Special Thanks\n\nThis plugin was inspired by\n[work from Stephen Mathieson](https://github.com/stephenmathieson/gatsby-plugin-segment).\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreyward%2Fgatsby-plugin-segment-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoreyward%2Fgatsby-plugin-segment-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreyward%2Fgatsby-plugin-segment-analytics/lists"}