You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the introduction of the Shopify Pixel Extension for tracking, management of the cookies and storage values for product views and cart contents are primarily handled by the extension. This is great because changes to the cart happen automatically as the cart is modified - currently though, we don't have a way of knowing when the extension is making those changes.
For recommendation realtime functionality to properly work with the Shopify Pixel we will need to leverage the fact that this extension also manages a localStorage entry ssCartProductsLocal (which we can rename if desired) that is kept up to date with the current cart contents. The idea is that instead of requiring cart attribution tracking in the integration, we could seamlessly connect with changes to ssCartProductsLocal. This will require a bit of a refactor to the snap-tracker, but would enable us to get realtime functionality much easier and more reliably.
This change also ties into our desire to move to having both cookies and storage for fallback for personalization data. This may mean that we could look into consolidating this data into a single storage entry instead of spanning multiple entries.
window.addEventListener('storage', function(event){
// listen for changes to our storage entry
}, false);
We were unable to use the suggested window.storage event due to the event only getting called if storage changes from another tab..
We then tried just manually triggering the storage event from the pixel, but ran into issues there as well because the "browser" api only gives access to the local storage and not the window.
SO now we have decided to just poll every 500ms for changes to local storage, only checking for a few seconds after each click on the document.
With the introduction of the Shopify Pixel Extension for tracking, management of the cookies and storage values for product views and cart contents are primarily handled by the extension. This is great because changes to the cart happen automatically as the cart is modified - currently though, we don't have a way of knowing when the extension is making those changes.
For recommendation
realtime
functionality to properly work with the Shopify Pixel we will need to leverage the fact that this extension also manages a localStorage entryssCartProductsLocal
(which we can rename if desired) that is kept up to date with the current cart contents. The idea is that instead of requiring cart attribution tracking in the integration, we could seamlessly connect with changes tossCartProductsLocal
. This will require a bit of a refactor to the snap-tracker, but would enable us to get realtime functionality much easier and more reliably.This change also ties into our desire to move to having both cookies and storage for fallback for personalization data. This may mean that we could look into consolidating this data into a single storage entry instead of spanning multiple entries.
https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event
The text was updated successfully, but these errors were encountered: