Page MenuHomePhabricator

Regression: QuickSurveys doesn't log QuickSurveysInitiation events
Open, MediumPublicBUG 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)

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.:

  $panel[ 0 ],
).then( function ( el ) {
  // eslint-disable-next-line no-use-before-define
  reportWhenSeen( el, surveySessionToken, pageviewToken, );
} );

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        perceived-performance-survey    152        perceived-performance-survey    11734        perceived-performance-survey    1132        perceived-performance-survey    19647
ovasileva triaged this task as Medium priority.Tue, Nov 16, 10:25 AM
ovasileva added a subscriber: ovasileva.

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

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

Jdlrobson added a subscriber: Jdlrobson.

@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:

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: