Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
gtm-react-hook
Advanced tools
```npm install gtm-react-hook```
or
```yarn add gtm-react-hook```
import React, { FC, useEffect } from "react";
import { useGTM } from "gtm-react-hook";
import { useLocation } from "react-router-dom";
const App = () => {
const { runGTM, eventGTM } = useGTM();
const location = useLocation();
useEffect(() => {
runGTM({
tagId: "GTM-XXXXXXX", // Provide your Tag ID
});
}, []);
useEffect(() => {
eventGTM("page_view", {
pathname: location.pathname,
});
}, [location.pathname]);
return <>...</>;
};
const { runGTM, eventGTM } = useGTM();
const { eventGTM } = useGTM();
const location = useLocation();
useEffect(() => {
eventGTM("page_view", { location: location.pathname });
}, [location]);
const { eventGTM } = useGTM();
const handleSaveCustomerInfo = (customer) => {
eventGTM("customer_info", {
customerId: customer.customerId,
customerRegion: customer.customerRegion
});
}
...JSX...
<button onClick={handleSaveCustomerInfo}>Submit</button>
const { runGTM } = useGTM();
useEffect(() => {
runGTM({
gtmId: "GTM-XXXXXXX",
dataLayerName: "myGTMLayer", // all GTM events will be stored in `window.myGTMLayer` key
});
}, []);
const { runGTM } = useGTM();
useEffect(() => {
if (isUserConfirmAnalytics) {
runGTM({
gtmId: "GTM-XXXXXXX",
});
}
}, [isUserConfirmAnalytics]);
const { runGTM } = useGTM();
useEffect(() => {
runGTM({
gtmId: "GTM-XXXXXXX",
devMode: true // add GTM logs to browser's console
});
}, []);
0.0.17
FAQs
Easy-to-use React hooks for Google Tag Management based on TypeScript
The npm package gtm-react-hook receives a total of 68 weekly downloads. As such, gtm-react-hook popularity was classified as not popular.
We found that gtm-react-hook 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.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.