![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
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.
react-metrics-service
Advanced tools
React adapter for metrics services like Google Analytics, Tealium or Comcast.
React adapter for metrics services like Google Analytics, Tealium or Comcast.
First create your metrics-service module (eg. using google analytics) in the file my-metrics.js
:
// my-metrics.js
import { createClient, googleAnalytics } from 'react-metrics-service'
const client = createClient()
client.addDispatcher(googleAnalytics({ trackingID: 'UA-000000-01' }))
export default client
You can create your own metrics-service module, check some examples in src/dispatchers
Use the service directly like:
import myClient from 'my-metrics'
export default () => {
// ...
myClient.callDispatchers('gaSend', 'event', 'Video', 'play')
// ...
}
With Proxy support you can also write:
import myClient from 'my-metrics'
export default () => {
// ...
myClient.gaSend('event', 'Video', 'play')
// ...
}
Add metricsServiceContext
high order component to your app root component:
import { metricsServiceContext } from 'react-metrics-service'
import myClient from 'my-metrics'
const App = (
// ... your app here
)
export default metricsServiceContext({ client: myClient })(App)
Then you can use the withMetricsServiceClient
HOC:
import { withMetricsServiceClient } from 'react-metrics-service'
const Component = ({
metricsServiceClient
}) => {
// ...
metricsServiceClient.gaSend('event', 'Video', 'play')
// ...
}
export default withMetricsServiceClient()(Component)
Or the metricsServiceClick
HOC:
import { metricsServiceClick } from 'react-metrics-service'
import MyComponent from 'my-component.js'
export default metricsServiceClick('gaSend', 'event', 'Video', 'play')(MyComponent)
import {
createClient,
googleAnalytics,
googleAnalyticsLegacy,
googleTagManager,
tealium,
debugLog
} from 'react-metrics-service'
const client = createClient()
client.addDispatcher(googleAnalytics({ trackingID: 'UA-000000-01' }))
client.addDispatcher(googleAnalyticsLegacy({ trackingID: 'UA-000000-01' }))
client.addDispatcher(googleTagManager({ containerID: 'GTM-0000', dataLayer: {} }))
client.addDispatcher(tealium({ account: 'acc', profile: 'pro', env: 'dev', utag_data: {} }))
client.addDispatcher(debugLog)
First of all, thank you for wanting to help!
git checkout -b more_magic
npm test
git commit -am "Added more magic"
git push origin more_magic
FAQs
React adapter for metrics services like Google Analytics, Tealium or Comcast.
The npm package react-metrics-service receives a total of 0 weekly downloads. As such, react-metrics-service popularity was classified as not popular.
We found that react-metrics-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
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.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.