File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { Header } from 'common';
77
88import Script from 'next/script' ;
99
10- import * as gtag from '.. /libs/gtag' ;
10+ import * as gtag from 'client /libs/gtag' ;
1111
1212import Providers from './providers' ;
1313
Original file line number Diff line number Diff line change 1+ export const GA_TRACKING_ID = process . env . NEXT_PUBLIC_GA_ID ;
2+
3+ // https://developers.google.com/analytics/devguides/collection/gtagjs/events
4+ export const event = (
5+ action : Gtag . EventNames ,
6+ { event_category, event_label, value } : Gtag . EventParams
7+ ) => {
8+ window . gtag ( 'event' , action , {
9+ event_category,
10+ event_label,
11+ value,
12+ } ) ;
13+ } ;
14+
15+ // https://developers.google.com/analytics/devguides/collection/gtagjs/pages
16+ export const pageview = ( url : URL ) => {
17+ if ( GA_TRACKING_ID )
18+ window . gtag ( 'config' , GA_TRACKING_ID , {
19+ page_path : url ,
20+ } ) ;
21+ } ;
You can’t perform that action at this time.
0 commit comments