Expand my Community achievements bar.

SOLVED

Launch Data Element Storage Duration Subdomain

Avatar

Level 2

I would like to preserve information of the visitor between subdomains. I set a data Element e.g "favouriteProduct" where Storage Duration = Visitor. On the website e.g. a.main.it (where the user is logged in) "favouriteProduct"= "apple". This information is preserved each time visitor lands on a.main.it, but when the user logout and lands on main.it, my dataElement "favouriteProduct" = null. The mid visitor number is the same for both the domains. In adobe launch Storage Duration = Visitor which information about the user it stores?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

AEP Data Collection Tags (a.k.a. Adobe Launch) uses the browser's localStorage when a data element's Storage Duration is set to "Visitor". However, localStorage is, by design, set per domain per port in all browsers. See https://stackoverflow.com/questions/4201239/in-html5-is-the-localstorage-object-isolated-per-page-do...

That means a localStorage item that is saved at a.main.it cannot be used at main.it nor www.main.it.

As a result, what you're experiencing with your "Visitor" Storage Duration is the correct behaviour.

If you need to "remember" a value between domains, then your only option is cookies. At a.main.it, you'll set a cookie for the main.it domain with a very long expiration date. Then when the user is at main.it or www.main.it, that cookie can still be read.

Keep in mind that with modern browser privacy restrictions, e.g. Apple's ITP, your long-expiration cookie may be subject to limitations that are inherent to the browser being used, and there's no way around that.

View solution in original post

4 Replies

Avatar

Community Advisor and Adobe Champion

I've not tried this particular scenario... but to help understand the final goal, I have a question.... is the final goal just to have a value stored in your analytics data at the Visitor level, or do you need to read the value on main domain to have logic around it?

 

If the first, it might just be easier to store "favouriteProduct" in an eVar set to Expire After "Never". Then you would be relying on the Adobe Tracking to ensure the value is set in your data automatically based on the User ID in the data, as opposed to trying to maintain the value in client side.

 

However, if you actually need to perform some sort of logic check (i.e. if the user's favouriteProduct is "apple" then do X) then this won't actually work for you...

 

But you could also try manually setting a localstorage object... I know, it's not ideal....

 

Maybe someone who has used Visitor level duration on the Data Elements would have some more suggestions.

Avatar

Level 2

Hi J Dungan, thank you for your answer.
I need the second one:
i.e. if the user's favouriteProduct is "apple" then do X)

I wolud like to do this without setting specific cookie

Avatar

Community Advisor and Adobe Champion

Ok, I definitely hear you on that one Setting additional cookies and storage items is something to avoid when possible.. I just wish I could help you sort out why the value isn't being carried over.

 

This is going to sound silly... but you are sure that the data element isn't running despite the retention period? I know it's not supposed to... but maybe it's running and it's overwriting the value on the main domain, and with nothing to populate it, it's now become null?

Avatar

Correct answer by
Community Advisor

AEP Data Collection Tags (a.k.a. Adobe Launch) uses the browser's localStorage when a data element's Storage Duration is set to "Visitor". However, localStorage is, by design, set per domain per port in all browsers. See https://stackoverflow.com/questions/4201239/in-html5-is-the-localstorage-object-isolated-per-page-do...

That means a localStorage item that is saved at a.main.it cannot be used at main.it nor www.main.it.

As a result, what you're experiencing with your "Visitor" Storage Duration is the correct behaviour.

If you need to "remember" a value between domains, then your only option is cookies. At a.main.it, you'll set a cookie for the main.it domain with a very long expiration date. Then when the user is at main.it or www.main.it, that cookie can still be read.

Keep in mind that with modern browser privacy restrictions, e.g. Apple's ITP, your long-expiration cookie may be subject to limitations that are inherent to the browser being used, and there's no way around that.