Shopify / hydrogen

Hydrogen lets you build faster headless storefronts in less time, on Shopify.
https://hydrogen.shop
MIT License
1.21k stars 243 forks source link

Hydrogen: Conversion Summary doesn't work #925

Closed abwhb closed 1 year ago

abwhb commented 1 year ago

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2023.4.0

What version of Remix are you using?

1.15

Steps to Reproduce

Make a purchase on hydrogen store

Expected Behavior

Conversion summary should show summary of the session that was converted

Actual Behavior

Conversion summary shows checkout as the first page visited.

Screenshot 2023-05-23 at 14 45 30
abwhb commented 1 year ago

Hey @frehner - Can you give me an update on this issue?

wizardlyhel commented 1 year ago

Thank you for reporting this - There are still many parts of analytics dashboards that we are still working towards fixing for Hydrogen and Headless app.

wizardlyhel commented 1 year ago

From the looks of it, you have everything setup properly, we'll investigate into this.

wizardlyhel commented 1 year ago

Actually, @blittle notice that the cookies isn't setup properly. Please make sure the domain is set with

useShopifyCookies

useShopifyCookies({
  hasUserConsent: true,
  domain: 'luxhomedecor.com',
})
abwhb commented 1 year ago

@wizardlyhel @blittle Thanks! I'll add domain to useShopifyCookies and see if that fixes the conversion summary

abwhb commented 1 year ago

@wizardlyhel @wizardlyhel updating useShopifyCookies fixed the issue. Thanks!

Chadyka commented 1 year ago

@wizardlyhel I am having the same issues with the conversion summary as well, the only difference is that I'm using a headless Next.js storefront with Hydrogen sales channel tokens. I have set up useShopifyCookies with the domain parameter just like you mentioned before. Do you have any input on why is it not working for me or if I can provide any additional information?

wizardlyhel commented 12 months ago

@Chadyka

Chadyka commented 12 months ago

@wizardlyhel

Normal session

Next storefront

shopify-normal-session-tld

Checkout cookies from [storename].myshopify.com

shopify-normal-session-checkout-store-domain

Checkout cookies from checkout.myshopify.com

shopify-normal-session-checkout-domain-checkout

Incognito session

Next storefront

shopify-incognito-session-tld

Checkout cookies from [storename].myshopify.com

shopify-incognito-session-checkout-storefront

Checkout cookies from checkout.myshopify.com were not available (maybe due to incognito mode not allowing third party cookies?)

wizardlyhel commented 12 months ago

@Chadyka You can't assign checkout.showme.hu domain to your online store?

Chadyka commented 12 months ago

@wizardlyhel sorry, I must have misunderstood your reply. I'll check back once I tested this.

Chadyka commented 12 months ago

@wizardlyhel after changing the online store domain to checkout.showme.hu the cookies are matching between the Next store and checkout in an incognito session. However, in a normal session I'm getting 2 sets of cookies from showme-shop-live.myshopify.com and showme.hu on the Next storefront.

Screenshot from 2023-06-06 12-00-33

After that, the checkout page checkout.showme.hu now contains correct cookies for the top level domain.

Screenshot from 2023-06-06 12-01-45

Even after this, the first visited page in conversion summary is /checkout/cn/[cart-token]

wizardlyhel commented 12 months ago

2 sets of the same cookie is fine. The other set is under 'showme-shop-live.myshopify.com' which get set by the online store checkout and won't be accessible by JS anyways.

Give it at least 24hrs to 48hrs to for session data correct over time and make sure you are picking a session that started after you have made the domain change to see if it started working for you.

Chadyka commented 11 months ago

Hey @wizardlyhel, I wanted to get back to you about this issue. I have been doing analytics event testing on my store and I was also checking if the conversion summary would pick up. The things we discussed earlier are working as expected, however, the conversion summary still only shows checkout as the first page a user landed on. Do you have any further ideas on how I could track down the source of this issue?

wizardlyhel commented 11 months ago

I don't see the cookie values being send along with the sendShopifyAnalytics. Filter the network tab for product_batch request. You should see relatively the same payload as the screenshot that I have attached.

I think somehow the cookie isn't set before the Shopify analytics event is sent. That is why the conversion summary still thinks the first landing page is checkout

Screenshot 2023-06-12 at 9 19 49 AM
Chadyka commented 11 months ago

Hey @wizardlyhel, I believe to have solved the issue as I have been unable to reproduce your example with the missing tokens since a couple days. However, conversion summary is still showing the checkout as the first viewed page. Can you check if you can reproduce your example from before?

wizardlyhel commented 11 months ago

@Chadyka I think yours might be a slightly different issue. Your shop have many channels coming in which builds your order reports. Ones that might look odd are ones that comes directly to checkout from Linkpop, Instagram, Facebook ... etc. These won't have a first landing page at the url you expect, these will have checkout url as their first landing page because there is no connection in session cookie.

Chadyka commented 11 months ago

@wizardlyhel Would it make sense to use the LocalStorage of the client to store the tokens and use them instead of just getClientBrowserParameters() to collect the cookies/tokens? Should I set some other variables that getClientBrowserParameters collects to handle analytics better?

wizardlyhel commented 11 months ago

@Chadyka At least for that particular report you are indicating, it won't be possible to make the session association because they are from a completely different domains. Cookies are inaccessible across domains for security reasons. These orders are coming from other sales channels that is not Hydrogen. So it would be more accurately look at them from the sales by referrer report instead.