Expand my Community achievements bar.

Guidance Required on User ID Implementation Strategy

Avatar

Level 3

Hi all,

 

We have a new website where we want to assign a User ID to every user, but we currently do not have a data layer implemented. The developer has now added the User ID into an eVar using code within a link-tracking call instead of the page-view call.

 

I want to confirm if placing the User ID in a link-tracking call will cause any issues. This link call only fires when a user logs in. Since it is an eVar, my understanding is that the value should persist for the entire visit once it is set.

 

Is this approach acceptable, or is there a better way to handle this?

 

Thank You.

2 Replies

Avatar

Adobe Champion

Hi @GV16  Yes technically this approach works. Setting the user id evar in a link tracking call works fine as long as the eVar is included in linktrackvars and the evar expiration is set to visit  
once set it will persist for the rest of the visit or depending on expiration.

Also, the developer can store the user id in local storage and then read it and set the same evar on every hit

 

or as a future enhancement the best approach is simply have the developer send the user id on every hit either through a datalayer or similar approach after login rather than only on the login link call.

 

Pls refer below links to understand eVar expiration. and linktrackvars
https://experienceleague.adobe.com/en/docs/analytics/admin/admin-tools/manage-report-suites/edit-rep...

https://experienceleague.adobe.com/en/docs/analytics/implementation/vars/config-vars/linktrackvars

 

Avatar

Community Advisor and Adobe Champion

While yes, the developer setting s.eVarX to a value should work, it should get picked up by your page views (but not your actions unless you explicitly add the eVar to your link/action tracking calls using s.linkTrackVars); but as you said, if the expiry is visit, then the value will persist on your links/actions.

 

However, there are some considerations:

  • If the s object isn't yet initiated when the developer tries to set s.eVarX to the value, then you will miss the data
  • If the first call on the site is a link/action (i.e. this triggers before the first page view), then there won't be a value for the first hit

 

Like @Sumit-Kumar, I would be more tempted to have the developers set a session or local storage value (or modify your data layer to include the information), and use Launch to pick up the value from there, and set the eVar yourself in your implementation.