Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@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.
@docusaurus/plugin-google-gtag
Global Site Tag (gtag.js) plugin for Docusaurus.
FAQs
Global Site Tag (gtag.js) plugin for Docusaurus.
The npm package @docusaurus/plugin-google-gtag receives a total of 238,822 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.