Page MenuHomePhabricator

Regression: QuickSurveys doesn't log QuickSurveysInitiation events
Closed, ResolvedPublicBUG REPORT

Description

Report

List of steps to reproduce (step by step, including full links if applicable):

What happens?:

No QuickSurveysInitiation{eventName="impression",surveyCodeName="perceived-performance-survey"} event is logged.

What should have happened instead?:

Such an event should be logged.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:

  • Browser: Google Chrome (95.0.4638.69)
  • OS: macOS Monteray (12.0.1)
Notes

After a survey has been selected, QuickSurveys inserts a panel (a <div>) with a spinner while the surveys messages are fetched and the survey is rendered. QuickSurveys also sets up an IntersectionObserver to detect when the survey has been seen by the user. However, when the survey is rendered using Vue.js, the original container element is destroyed as the component mounts.

Fortunately, when the component mounts, it resolves a promise with the element that Vue.js has rendered. QuickSurveys needs to be updated to use that element when setting up the IntersectionObserver here, i.e.:

resources/ext.quicksurveys.lib/lib.js
module.render(
  $panel[ 0 ],
  survey,
  dismissSurvey,
  surveySessionToken,
  pageviewToken,
  isMobileLayout
).then( function ( el ) {
  // eslint-disable-next-line no-use-before-define
  reportWhenSeen( el, surveySessionToken, pageviewToken, survey.name );
} );

Event Timeline

What's giving me pause about this is that we're still seeing events for the "perceived performance" survey.

select webhost, event.surveyCodeName, count(*) from quicksurveyinitiation where year=2021 and month=11 group by webhost, event.surveyCodeName;
webhost surveycodename  _c2
ca.wikipedia.org        perceived-performance-survey    152
es.wikipedia.org        perceived-performance-survey    11734
fr.wikipedia.org        perceived-performance-survey    1132
ru.wikipedia.org        perceived-performance-survey    19647
ovasileva triaged this task as Medium priority.Nov 16 2021, 10:25 AM
ovasileva subscribed.

Pulling this into Kanban board as it might affect surveys that are currently running

Change 741930 had a related patch set uploaded (by Jhernandez; author: Jhernandez):

[mediawiki/extensions/QuickSurveys@master] Emit QuickSurveyInitiation observing the Vue app's element

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

I've taken a stab at this, since we're planning on deploying a survey to Persian and Catalan the week of Dec 6th, and it would be nice if we could see these events.

I've tested it locally and it seems to work for me:

image.png (1×2 px, 315 KB)

@phuedx 's comment gives me pause too. I saw here:

In Vue 2.x, when mounting an application that has a template, the rendered content replaces the element we mount to.

So the theory checks out, but then no events should be present at all?

I'm not bringing this to my team's kanban board because I don't think we should merge this without the web team's review.

Change 741930 merged by jenkins-bot:

[mediawiki/extensions/QuickSurveys@master] Emit QuickSurveyInitiation observing the Vue app's element

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

Jdlrobson subscribed.

@Jhernandez is this fixed now? Is there anything left to do (e.g. backport?)

This should roll out this week, so if there is any effects we should see them in the dashboard hopefully. It would be good to verify if there's any change or not.

I also found out that the initiation dashboard is actually:

https://grafana.wikimedia.org/d/000000018/eventlogging-schema?orgId=1&var-schema=QuickSurveyInitiation&from=now-7d&to=now

QuickSurveyInitiation, not QuickSurveysInitiation (extra s). QuickSurveysResponses is plural though.

It is very confusing that there are 5 or 6 dashboards with slightly different wording when you search for QuickSurveys in that EventLogging dashboard.

@phuedx and I made a specific QuickSurveys dashboard based on the EventLogging one which should help in the future:

I think this is working now that wmf.12 is back on (there were spikes for a day+ that occurred when wmf.12 was rolled out before the brief rollback to wmf.9)

Screen Shot 2021-12-13 at 1.30.16 PM.png (2×3 px, 531 KB)