-
Notifications
You must be signed in to change notification settings - Fork 12
Conversation
What would be the difference for Is there a possibility of an isomorphic implementation, or would it be too difficult to condense these functions? |
Difference would be the client implementation would have network api implementation fallbacks like how Trekkie does: server implementation wouldn't have these network api available. There are other analytics reporting techniques we can add to the client implementation (ie. leaky bucket implementation), however, none of these client side code path should exist in the server implementation. For performance reasons, I like to separate them |
* add analytic-utils tests and refactor
* add support for parsing complex gids and fix failing test * shorten cond checks * remove incorrect complex id parsing * fix typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! This first pass review is just from looking at the code; I'll spend some time soon actually running the code locally and playing around with it. ❤️
const router = useRouter(); | ||
const hasUserConsent = true; | ||
|
||
// eslint-disable-next-line react-hooks/exhaustive-deps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this? Thanks.
let perfNumber = 0; | ||
|
||
// Result of zero-fill right shift is always positive | ||
dateNumber = new Date().getTime() >>> 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wut hahaha. I'm going to have to play around and see what this is doing. Apparently something with positive integers... which makes sense in a function called hexTime
. Hmmm
Co-authored-by: Anthony Frehner <frehner@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much!
in next.js, is Also, does this need to be on primary domain to work? Vercel previews - I'm not seeing traffic from me on the "Live View" |
No, that's just an example.
Can you clarify what you mean here? Are you saying that when you use a Vercel preview, you don't see your traffic info in Shopify? If so, can you check to make sure that the analytics code is running in your browser and making network requests? You should see network requests to either If you're having issues, please open a new issue in this repo with this information. 👍 |
I don't know what vercel preview url scheme is like, however, if you want to see add-to-cart (Live View) working.
We are missing documentation on these newly introduced functions and we're working on it |
Hi @wizardlyhel , this is really cool thanks! I replicated all the steps, i see when someone is one the website in the liveview, but for some reason i dont get the ATC events in the live view. I used the example hook of the Hydrogen Demo store and implemented it in my own Hydrogen(remix) project. I use oxygen for hosting but still dont get any ATC event trough to my live view. Even when im on the When i go to the URL, i see the request to What is in your opinion the best way to debug these issues? Is there a way you can enable the localhost ATC just for debugging? |
Make sure your storefront api shop domain is sending to Since your app is on Live view - If you want to test locally, you can ngrok your localhost to a tunnelled ip address and make sure to add an item to cart to start seeing live view working (This should work - not 100% certain) |
Thanks @wizardlyhel for the extensive response, i couldnt get it working yet with your solution but will keep trying. Do you know if the Hydrogen demo store analytics are fully working? |
Just double check on the latest Hydrogen remix build - You are right. The ATC session on Live View doesn't work. I'll get that fix. However, you should be able to see |
PR to fix on Hydrogen - Shopify/hydrogen#614 |
Shopify Analytics components
These analytics components are designed to work on any frameworks written in React.
All inputs are fully typed.
useShopifyCookies(hasUserConsent = false, domain = '')
Creates and refreshes
_shopify_y
andshopify_s
cookie.Usage:
sendShopifyAnalytics
Reports analytics to Shopify
Usage:
getClientBrowserParameters()
Collects client browser specific data.
Follow-up PRs:
__HYDROGEN_DEV__
Additional context
Before submitting the PR, please make sure you do the following:
fixes #123
)yarn changeset add
if this PR cause a version bump based on Keep a Changelog. If you have a breaking change, it will need to wait until the next major version release. Otherwise, use patch updates even for new features. Read more about Hydrogen-UI's versioning.