Security News
Internet Archive Hacked, 31 Million Record Compromised
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
@uniformdev/context-gtag
Advanced tools
Uniform Context Google global site tag analytics package
Contains a plugin for analytics event emission to Google Analytics via gtag.js
part of the Uniform Platform. See our documentation for more details.
This package is a plugin for Uniform Context, so we just add it like this:
import { Context, ManifestV2, ContextPlugin } from "@uniformdev/context";
import { NextCookieTransitionDataStore } from "@uniformdev/context-next";
import { NextPageContext } from "next";
import manifest from "./manifest.json";
import { enableGoogleGtagAnalytics } from '@uniformdev/context-gtag';
export function createUniformContext(serverContext?: NextPageContext) {
const plugins: ContextPlugin[] = [enableGoogleGtagAnalytics()];
const context = new Context({
manifest: manifest as ManifestV2,
transitionStore: new NextCookieTransitionDataStore({
serverContext,
}),
plugins: plugins
});
return context;
}
and then load Google Analytics tracking itself in _document.tsx
:
class MyDocument extends Document {
render(): React.ReactElement {
return (
<Html lang="en">
<Head />
<body className="leading-normal tracking-normal text-white gradient">
<script async src={`https://www.googletagmanager.com/gtag/js?id=${process.env.YOUR_GA_ID}`}></script>
<script
dangerouslySetInnerHTML={{
__html: `
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${gaTrackingId}', {
page_path: window.location.pathname,
});
`
}}
/>
<Main />
<NextScript />
</body>
</Html>
);
}
}
export default MyDocument;
or you can include Gtag via GTM - https://support.google.com/tagmanager/answer/6102821?hl=en_US
This package uses event_category
, event_label
properties from GA UA
which are not supported by GA4 by default. Also Uniform is using property is_control_group
.
You will have to create these as Custom Dimensions yourself. See https://support.google.com/analytics/answer/10075209?hl=en#new-custom-dimension for more info
FAQs
Uniform Context Google global site tag analytics package
The npm package @uniformdev/context-gtag receives a total of 797 weekly downloads. As such, @uniformdev/context-gtag popularity was classified as not popular.
We found that @uniformdev/context-gtag demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
Security News
TC39 is meeting in Tokyo this week and they have approved nearly a dozen proposals to advance to the next stages.
Security News
Our threat research team breaks down two malicious npm packages designed to exploit developer trust, steal your data, and destroy data on your machine.