Skip to content

Commit

Permalink
Dont send ga unless production (#1045)
Browse files Browse the repository at this point in the history
Co-authored-by: Chase Fleming <[email protected]>
  • Loading branch information
chasefleming and chasefleming authored Dec 13, 2024
1 parent 8507a96 commit ead74c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Empty file added src/components/modal.tsx
Empty file.
4 changes: 4 additions & 0 deletions src/utils/gtags.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ declare global {
* https://developers.google.com/analytics/devguides/collection/gtagjs/pages
*/
export const pageview = (url: string, trackingId: string) => {
if (window.ENV.NODE_ENV !== "production") return

if (!window.gtag) {
console.warn(
"window.gtag is not defined. This could mean your google anylatics script has not loaded on the page yet."
Expand All @@ -41,6 +43,8 @@ export const event = ({
label?: string;
value?: number | string;
}) => {
if (window.ENV.NODE_ENV !== "production") return

if (!window.gtag) {
console.warn(
"window.gtag is not defined. This could mean your google anylatics script has not loaded on the page yet."
Expand Down

0 comments on commit ead74c0

Please sign in to comment.