Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@docusaurus/plugin-google-gtag
Advanced tools
Global Site Tag (gtag.js) plugin for Docusaurus
@docusaurus/plugin-google-gtag is a plugin for Docusaurus that integrates Google Analytics (via gtag.js) into your Docusaurus site. It allows you to track page views and other events to gain insights into your site's traffic and user behavior.
Basic Setup
This feature allows you to set up the Google Analytics tracking ID and anonymize IP addresses. The tracking ID is required to link your site to your Google Analytics account.
{
"plugins": [
[
"@docusaurus/plugin-google-gtag",
{
"trackingID": "YOUR_GOOGLE_ANALYTICS_TRACKING_ID",
"anonymizeIP": true
}
]
]
}
Custom Events
This feature allows you to track custom events such as button clicks. You can use the `useGtag` hook to send custom events to Google Analytics.
{
"plugins": [
[
"@docusaurus/plugin-google-gtag",
{
"trackingID": "YOUR_GOOGLE_ANALYTICS_TRACKING_ID",
"anonymizeIP": true
}
]
]
}
// In your React component
import React from 'react';
import { useGtag } from '@docusaurus/plugin-google-gtag';
const MyComponent = () => {
const gtag = useGtag();
const handleClick = () => {
gtag('event', 'click', {
event_category: 'button',
event_label: 'my_button'
});
};
return <button onClick={handleClick}>Click me</button>;
};
export default MyComponent;
react-ga is a JavaScript module that allows you to easily add Google Analytics to your React application. It provides a simple API for tracking page views and custom events. Compared to @docusaurus/plugin-google-gtag, react-ga is more general-purpose and can be used with any React application, not just Docusaurus.
gatsby-plugin-google-gtag is a Gatsby plugin that integrates Google Analytics using gtag.js. It offers similar functionalities to @docusaurus/plugin-google-gtag but is specifically designed for Gatsby sites. It allows you to track page views and custom events in a Gatsby application.
next-google-analytics is a Next.js plugin for integrating Google Analytics using gtag.js. It provides an easy way to add Google Analytics to your Next.js application and track page views and custom events. Like @docusaurus/plugin-google-gtag, it is tailored for a specific framework, in this case, Next.js.
FAQs
Global Site Tag (gtag.js) plugin for Docusaurus.
The npm package @docusaurus/plugin-google-gtag receives a total of 284,801 weekly downloads. As such, @docusaurus/plugin-google-gtag popularity was classified as popular.
We found that @docusaurus/plugin-google-gtag demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.