-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!:
disableAnalytics
and enableAnalytics
- Loading branch information
1 parent
3bd75af
commit 998fee6
Showing
7 changed files
with
91 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export function disableAnalytics(id: string) { | ||
(window as any)[`ga-disable-${id}`] = true | ||
} | ||
|
||
export function enableAnalytics(id: string) { | ||
const key = `ga-disable-${id}` | ||
|
||
if (key in window) | ||
delete (window as any)[key] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import type { ControlParams, EventNames, EventParams } from '../types' | ||
import type { GtagCommands } from '../types' | ||
import { useGtag } from './useGtag' | ||
|
||
export function useTrackEvent( | ||
eventName: EventNames | (string & Record<never, never>), | ||
eventParams?: ControlParams | EventParams | Record<string, any>, | ||
...args: GtagCommands['event'] | ||
) { | ||
const { gtag } = useGtag() | ||
gtag('event', eventName, eventParams) | ||
gtag('event', ...args) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters