forked from frontvibe/fluid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UNSTABLE_Analytics and remove useAnalytics hook Add PUBLIC_CHECKOUT_DOMAIN
- Loading branch information
Showing
15 changed files
with
165 additions
and
233 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,32 @@ | ||
import {unstable_useAnalytics as useAnalytics} from '@shopify/hydrogen'; | ||
import {useEffect} from 'react'; | ||
|
||
import {useIsDev} from '~/hooks/useIsDev'; | ||
|
||
export function CustomAnalytics() { | ||
const {subscribe} = useAnalytics(); | ||
const isDev = useIsDev(); | ||
|
||
useEffect(() => { | ||
if (!isDev) return; | ||
|
||
// Standard events | ||
subscribe('page_viewed', (data) => { | ||
console.log('CustomAnalytics - Page viewed:', data); | ||
}); | ||
subscribe('product_viewed', (data) => { | ||
console.log('CustomAnalytics - Product viewed:', data); | ||
}); | ||
subscribe('collection_viewed', (data) => { | ||
console.log('CustomAnalytics - Collection viewed:', data); | ||
}); | ||
subscribe('cart_viewed', (data) => { | ||
console.log('CustomAnalytics - Cart viewed:', data); | ||
}); | ||
subscribe('cart_updated', (data) => { | ||
console.log('CustomAnalytics - Cart updated:', data); | ||
}); | ||
}, [subscribe, isDev]); | ||
|
||
return null; | ||
} |
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
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.