can someone tell me how anonymous ID is assigned t...
# support
f
can someone tell me how anonymous ID is assigned to any user who visits the store. We have a test store in which we have done the ruddderstack integration, the problem is i am not able to get an overview of when and how anonymous Id is assigned to a visitor. I tested this case: Say a person visits the store, and register as a user then the anonymous_Id 1 and user_id 1 is created now in the same tab and browser and clearing the cache, and coming as a different person and registering as a user from different credentials should ideally give me anonymous_id 1 (because i am in the same tab/browser) and user_id 2 , but it is giving me anonymous_id 2 and user_id 2. Thread in Slack Conversation
m
Hey There! 👋 Your message has been received by the RudderStack team. We will forward this request to your Technical Account Manager, and they will get back to you shortly. Please use the thread for any additional comments.
h
when you say cleared the cache - did you clear cookies
anon_id will be in a cookie - if that is cleaned you will get a new id - it is not a fingerprint
f
even if i am not clearing anything and logs in two times with different credentials it still gives me the same A1 U1 and A2 U2, however in this case ideally it should've given me A1 U1 and A1 U2
h
what code are you using to identify
it's also not a real world test really - how many folk use the same device/browser
f
could you just tell me when Anonymous ID is created and in which cases it changes
h
it checks the rudderstack cookie and uses the id if there else creates a new uuid
f
Can you give me the source from where you're giving me this
also, what can we do to make it a fingerprint
h
You can use fingerprint.js or a similar js library - I still dont understand the use case for multiple users on the same device/browser
f
replying to this: "- I still dont understand the use case for multiple users on the same device/browser" lets say you have a computer hub, and number of people visits and uses the same device and the browser, now in this case i want to distinguish them
h
easiest way would be to write js code to destroy the rudderstack cookies/localstorage when they hit a landing page before logging in
f
just check this one: in the same tab i logged out of the store and as soon as i logged out, why did the anonymous_id change. I didnt do any cookie or cache clearingm how did this change
h
dont know - would need to see code to try and work it out
m
So you are saying that the anonymous_id changed when you logged out? Are you making an Identify call at that point?
Also if you want to maintain the same anonymoud_id when the user_id changes, you can store that older anonymous_id and over-write the new one with the older anonymous_id using rudderanalytics.setAnonymousId()
f
see, ideally i want this to work like, suppose if a user comes to our store which has the rudderstack integration then the rudderstack assigns an anonymous_id to that anonymous user, now this anonymous user creates account in my store and now the user_id is registered corresponding to that anonymous_id, now this user does some activity in my store and all the events gets track with that anonymous_id and user_id. Now, if i log that out, and come again, then the anonymous_id should've been the same right, as i didnt clear any cache, neither did i change my configuration or browser , but as soon as i am logging out this registers a new anonymous_id, why is that so? what is there in this which is making the anonymous_id to be changed?
h
what rudderstack code are running on logout - is it rudderanalytics.reset(); ?
m
So if the userId changes from "userId_1" to "userId_2" then the anonymous_id is changed. In your case on logout are you setting the user_id to an empty string (""), when the user logs out? In this case you would get a new userId. As Redsquare pointed out what code are you running on logout?
f
I am not using any custom code for this, i am using the rudderstack application for the shopify store
?
h
From the rudder docs on their shopify integration "After the user places the order, a new journey starts; RudderStack then sets a new
anonymousId
and persists it throughout that journey."
f
could you tell me why i am not able to sync my postgres data in real time, after integrating it to shopify store, any event of the user in the tracks, is reflected after 10 mins. What could be the issue
?
m
Hi Kartik, the following may be the reasons for delay in Postgres - Events sent to Warehouse in blocks - Destination Pods are shared among for free customers.
Also let me check with the team if we run some code on user-logout in the shopify app.
f
yes please check
m
Is there a way the team can test your shopify app?
However, I did not find any call to Logout or rudderanalytics.reset() anywhere in this code https://github.dev/rudderlabs/rudderstack-shopify-app
h
no but as soon as the order is done the anon id is changed
f
what are your requirements for the testing?
m
Hi Kartik, the team mentioned that they will support a toggle for Shopify source whether to delete the user_id and anonymous_id on Logout. This has been added to the backlog but since it has come from the community may take a few days to roll out.