Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
gatsby-plugin-segment-analytics
Advanced tools
Gatsby plugin that adds Segment's Analytics.js tracking snippet and tracks page views.
A Gatsby plugin to add Segment’s Analytics.js integration.
This is designed to work with Gatsby versions ≥ 2.0.0.
Install with yarn...
yarn add gatsby-plugin-segment-analytics
or NPM...
npm i gatsby-plugin-segment-analytics
In your gatsby-config.js
, add the gatsby-plugin-segment-analytics
plugin and
provide your Segment Analytics.js write key as an option:
module.exports = {
plugins: [
{
resolve: "gatsby-plugin-segment-analytics",
options: {
writeKey: "YOUR WRITE KEY",
// Optional page name to send with page events; not set by default
eventName: "YOUR PAGE EVENT NAME",
},
},
],
}
The latest version of the Segment tracking snippet will automatically be
generated and injected into the <head>
of your layout using Gatsby's SSR API
hooks. When a page is loaded, and Gatsby's onRouteUpdate
API is called,
analytics.page
will be fired.
In development, window.analytics
is a shim that simply logs calls to the
console rather than sending noise to Segment.
To make it easy to track clicks on outbound links, this plugin provides an
OutboundLink
component similar to the one provided by
gatsby-plugin-google-analytics.
To use it, simply import it and use it like you would the <a>
element e.g.
import React
import { OutboundLink } from "gatsby-plugin-segment-analytics"
export default () => {
<div>
<OutboundLink
href="https://www.gatsbyjs.org/packages/gatsby-plugin-segment-analytics/"
>
Visit the Segment Analytics plugin page!
</OutboundLink>
</div>
}
You can optionally provide an eventName
and categoryName
prop to
OutboundLink. This will change the segment event name (which is defaulted to
"Click"), and the category name (which is a property of the segment event),
respectively. More information on the segment page event can be found
here
<OutboundLink
href="https://www.gatsbyjs.org/packages/gatsby-plugin-segment-analytics/"
eventName="Visit External Link"
categoryName="Gatsby Resource"
>
Visit the Segment Analytics plugin page!
</OutboundLink>
This plugin was inspired by work from Stephen Mathieson.
MIT
FAQs
Gatsby plugin that adds Segment's Analytics.js tracking snippet and tracks page views.
The npm package gatsby-plugin-segment-analytics receives a total of 25 weekly downloads. As such, gatsby-plugin-segment-analytics popularity was classified as not popular.
We found that gatsby-plugin-segment-analytics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.