Page MenuHomePhabricator

Pre and post-edit anonymous editor acquisition tours are displaying multiple times
Closed, ResolvedPublic

Description

Author: swalling

Description:
We're getting multiple reports that the pre and post-edit anonymous editor acquisition tours are displaying repeatedly per user. I have tested and confirmed this is the case, at least on English Wikipedia.


Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=64721

Details

Reference
bz65566

Event Timeline

bzimport raised the priority of this task from to Needs Triage.
bzimport set Reference to bz65566.

I think this is due to ResoureLoader's (the client-side in particular) use of localStorage for resource caching (JS/CSS, etc.). This adds up pretty quick, and browsers have a limit (you may see an error in your console, "Persistent storage maximum size reached".

This has been discussed before at bug 65364.

So we can work around this by using a cookie and/or solve/improve this in the long-term, by having ResourceLoader use less localStorage.

ori added a comment.May 21 2014, 2:33 AM

Using a cookie temporarily makes sense -- fixing the localStorage issue properly will take some work to get right.

ori added a comment.May 21 2014, 3:37 AM

Something like this would work too, by making activation conditional on the key not being present *and* on it being set successfully:

function shouldShow() {

		try {
			if ( localStorage.getItem( ctaFlagKey ) === null ) {
				localStorage.setItem( ctaFlagKey, 'true' );
				return localStorage.getItem( ctaFlagKey ) !== null;
			}
		} catch (e) {}
		return false;

}

This approach wouldn't work with $.jStorage, because it caches any stored value in an in-memory object, so the call $.jStorage.get will always succeed even when the value fails to persist.

Won't that cause it not to show the first time, if their storage happens to be full?

ori added a comment.May 21 2014, 4:51 AM

(In reply to Matthew Flaschen from comment #4)

Won't that cause it not to show the first time, if their storage happens to
be full?

Yes, that's the intent. It's the lesser evil: you only activate if you can be sure you can do it without repeatedly pestering the user.

(In reply to Ori Livneh from comment #5)

Yes, that's the intent. It's the lesser evil: you only activate if you can
be sure you can do it without repeatedly pestering the user.

Yes, but it also risks invalidating/weakening the experiment by providing too few people with the treatment. So the cookie is probably the way to go for now.

Since the Gerrit bot is slacking, Rob started this at https://gerrit.wikimedia.org/r/#/c/134540/2 .

Change 134540 had a related patch set uploaded by MZMcBride:
Use mw.cookie for CTA flag due to localStorage capacity issues

https://gerrit.wikimedia.org/r/134540

Change 134540 merged by jenkins-bot:
Use mw.cookie for CTA flag due to localStorage capacity issues

https://gerrit.wikimedia.org/r/134540