![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
gtm-react-hook
Advanced tools
Easy-to-use React hooks for Google Tag Management based on TypeScript
npm install gtm-react-hook
or
yarn add gtm-react-hook
import React, { 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,
});
};
return <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 2 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.