
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@keg-hub/rga4
Advanced tools
React Components and hooks for integrating Google Analytics 4 into an application
React context and hooks for integrating Google Analytics 4 into an application
yarn add @keg-hub/rga4
npm install @keg-hub/rga4
Important
import React, { useEffect, useCallback } from 'react'
import { RGA4Provider, useRGA4 } from '@keg-hub/rga4'
const Child = (props) => {
// Use the hook to get access to the Google Analytics Context
const rga4 = useRGA4()
useEffect(() => {
// Call the rga4.event method to send an analytics event
rga4.event('page_view', {
label: 'Github Readme',
category: 'engagement',
})
}, [])
// Custom analytics event when a button is clicked
const onClick = useCallback(() => {
// Call the rga4.event method to send an analytics event
rga4.event('button_click', {
event_label: 'Demo Button',
event_category: 'engagement',
})
}, [ rga4 ])
return (
<div>
<button onClick={onClick}>
Demo Analytics Event
</button>
</div>
)
}
export const Component = (props) => {
const measurementID = `Replace with your GA4 Measurement ID`
return (
<RGA4Provider
code={measurementID}
config={{ ...Optional gtag config object }}
gaCodes={[ ...Optional extra analytics IDs ]}
>
<Child />
</RGA4Provider>
)
}
FAQs
React Components and hooks for integrating Google Analytics 4 into an application
The npm package @keg-hub/rga4 receives a total of 1 weekly downloads. As such, @keg-hub/rga4 popularity was classified as not popular.
We found that @keg-hub/rga4 demonstrated a not healthy version release cadence and project activity because the last version was released 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
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.