Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@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.
2.0.0-alpha.32 (2019-11-04)
<Redirect>
component for client side redirect. Example Usage:import React from 'react';
import {Redirect} from '@docusaurus/router';
function Home() {
return <Redirect to="/docs/test" />;
}
CodeBlock
theme component, it is recommended to update your source code to have this feature. (#1860)@theme/Tabs
component to be able to create tabs with only one item.@theme/Heading
component. If there is no id, it should not create anchor link.themeConfig.algolia
is not defined, the custom searchbar won't appear. If you've swizzled Algolia SearchBar
component before, please update your source code otherwise CSS might break. See #1909 for reference.- <Fragment>
+ <div className="navbar__search" key="search-box">
USE_SSH
env variable during deployment to be the same as in v1.docs/
or /docs/xxxx
that does not match any existing doc page should return 404 (Not found) page, not blank page. (#1903)@docusaurus/core
dependencies/ node_modules over user's node_modules. This fix a bug whereby if user has core-js@3 on its own node_modules but docusaurus depends on core-js@2, we previously encounter Module not found: core-js/modules/xxxx
(because core-js@3 doesn't have that)./docs
route even if docs folder is empty. We also improved docs plugin test coverage to 100% for stability before working on docs versioning. (#1912)/blog/post-xxx
will request for next and prev blog post metadata too aside from target post metadata. We should only request target post metadata. (#1908)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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.