Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

[bug 1032455] Add helpfulness interface using GA #3282

Merged
merged 7 commits into from Jul 16, 2015

Conversation

hoosteeno
Copy link
Contributor

This is an experiment to determine whether people use the feature and whether we use the data from it.

@hoosteeno
Copy link
Contributor Author

I think this is not ready -- needs l10n at least.

@@ -0,0 +1,62 @@
(function(win, doc, $) {
if (document.cookie.replace(/(?:(?:^|.*;\s*)helpful-stfu\s*\=\s*([^;]*).*$)|^.*$/, "$1") !== 'true') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tumblr_ne2s3xznzu1rlkbimo1_400

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we use localStorage instead?

@groovecoder
Copy link
Contributor

Looks good to me, with 1 nit-pick: an article always asks me if it was helpful even if I've already voted 'Yes' or 'No' on it? Since users often navigate back and forth on pages on MDN, should we suspend the prompt if the user has already answered for the article in the last NN days? @stephaniehobson ?

If we wrap the js('document') call in the waffle flag I'll feel good merging and pushing this. It will start collecting some great data for us to decide if it's worth investing a full engineering project into this idea.

@hoosteeno
Copy link
Contributor Author

That's a good point -- an oversight, really. I'd rather fix it (making our interaction with localstorage a bit more complex) than bug people about the same article. Maybe a flag that expires after 6(?) months.

Will also fix the waffle setup.

@hoosteeno
Copy link
Contributor Author

O dang. Merge commit in there. Will extricate.

@hoosteeno hoosteeno force-pushed the 1032455-helpfulness branch 2 times, most recently from 90340d5 to edb6af6 Compare June 30, 2015 21:34
@groovecoder
Copy link
Contributor

Also need to re-word the commit message to be prefixed with "bug NNNNNNN"

var notification = mdn.Notifier.growl(ask, {closable: true, duration: 0}).question();

// answers to the simple question include...
$('#helpful-yes').click(function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new syntax is .on('click', function() {

@hoosteeno hoosteeno force-pushed the 1032455-helpfulness branch 4 times, most recently from ca530ce to abf41d4 Compare July 2, 2015 17:45
@groovecoder
Copy link
Contributor

@hoosteeno - want to assign someone specific to review?

@hoosteeno
Copy link
Contributor Author

@darkwing has been giving great feedback so far.

@groovecoder
Copy link
Contributor

@darkwing - got a chance to re-review this soon? I'd love to launch this tomorrow if possible so we can start collecting the data.

(function(win, doc, $) {
// no localStorage, no helpfulness rating
if (('localStorage' in win)) {
var stfu = localStorage.getItem('helpful-stfu') === 'true'; // true if ever clicked stfu
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of positivity, we should probably change the stfu references to ignore or something like that. stfu may reflect bad on us.

@darkwing
Copy link
Contributor

darkwing commented Jul 9, 2015

Outside of these two nits, I really like what you've done here!

// create a notification
function inquire() {
// dimension7 is "helpfulness"
ga('set', 'dimension7', 'Yes');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My last feedback is that this line should be moved to:

templates/includes/google_analytics.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I understand why this is a good idea in principle. But we're setting this dimension flag for users flagged by waffle, who have not said "Never ask me again" and who have not already responded to the inquiry on the page they're looking at. Replicating all that non-GA business logic in the GA file seems like a violation of DRY. Do you see another way to do it, or do you think maybe this should be an exception to the rule?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My 💵 0.02:

The point of the custom dimension is to analyze between 2 segments/cohorts in GA: 1. Those who saw the helpfulness feature and 2. Those who did not.

Given that, only setting the dimension when we create the (initial) notification makes sense to me. Otherwise, we'll be putting visitors into the "Saw helpfulness dialog" cohort even if they never saw the notification.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. In that case, I suggest:

if(win.ga) ga('set', 'dimension7', 'Yes');

..since we don't use GA locally. Threw an error for me.

@hoosteeno
Copy link
Contributor Author

I added code to resolve @darkwing's most recent comment (hoosteeno@9647828#diff-25a3d06887fce3344ebdad7742003900R16). Unless there are any further comments, this code is ready to merge. We can switch the flag after further coordination.

@groovecoder
Copy link
Contributor

:shipit:

@groovecoder
Copy link
Contributor

Any chance we can merge this in the next 30-60m? I'd like to push it (along with #3346) today if possible ...

@darkwing
Copy link
Contributor

Looks good, let's give it a try

@darkwing
Copy link
Contributor

R+

darkwing added a commit that referenced this pull request Jul 16, 2015
[bug 1032455] Add helpfulness interface using GA
@darkwing darkwing merged commit 73cb038 into mdn:master Jul 16, 2015
@groovecoder
Copy link
Contributor

Just a post-deploy note ... there was confusing behavior in prod where the share_links flag is enabled for super-users: I saw the helpfulness feature immediately without having to enable its waffle flag. Do we need to clean that up with a follow-up PR? I.e., to de-couple the logic in helpfulness.js from the or logic around js('document').

@stephaniehobson
Copy link
Contributor

Yeah, something needs to be done about that. I think a check for the waffle needs to be added to helpfulness.js

@hoosteeno
Copy link
Contributor Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants