-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix video tracking on AB test #3931
Conversation
</div> | ||
<%= render "govuk_publishing_components/components/govspeak", {} do %> | ||
<p><%= t('ab_testing.ready_reckoner_video_description') %></p> | ||
<p><a href="https://www.youtube.com/watch?v=xHn31myAkio">How do I budget for my Self Assessment tax bill?</a></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just wondering if we should put the href and link title in the locale file as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good shout, will look into.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @andysellick - this seems to be a very sensible change. My only concern is to wonder why we didn't do it like that originally so I'd be happier if one of the other requested reviewers could approve it as well in case there's a reason for that which I have missed. 🤔
I would certainly not have expected to implement this in this way more permanently if it was the outcome of the A/B Test.
Thanks @davidtrussler. I don't know why this was done like this originally, I think on the surface it seems like a reasonable way to do it if you're not familiar with the way our frontend components work. I think it's been a while since we (the frontend team) did any kind of talk about how frontend stuff works to the wider dev community and we're probably overdue. I'm glad you mentioned this because I've also been asked with fixing a similar problem with this change but that one's a bit more complicated to unravel. Can you take a look? |
@andysellick Ah right, so I think on that one there is no other way to do this since the alternate (A/B) content is provided by the translation files by design. I guess that in turn explains why this one was done in a similar way since it followed in the wake of the one you're referring to here (also under some duress over the Xmas period!) We queried this approach with @richardTowers at the time (since embedded videos was a more complex scenario than a simple text change) and it was agreed there was no other way than to approach it like this. |
Thanks, that's good to know. If it's just a temporary AB test then I'll take a look at seeing if changing the markup in the locale files could make the video tracking work 👍 |
Ah yeah, it was me that asked for it to be done like this originally - sorry about that. The reasoning was exactly as you suggest - it was a temporary solution, and the ugliness was acceptable in the short term. The longer term plan is to find an elegant way to have this kind of test created in a self-service way by content designers. I didn't predict the issues with tracking or stylesheet loading though. To be honest, I'm not sure why I didn't consider using the govspeak component... that seems like a better approach all around. Perhaps I'd suggest putting the whole govspeak block into the locale file though? Rather than splitting it into description / video bits? |
- move the text and link for the ready reckoner page AB test into the locale files - forgot to do this as part of a previous PR: #3931
What
Fixes video tracking on https://www.gov.uk/self-assessment-ready-reckoner
Note that this appears on the B variant of the A/B test, use the GOVUK browser extension to switch between them or use a mod header extension.
Frontend components should be implemented in templates or helpers, using the code examples found in https://components.publishing.service.gov.uk/component-guide. Injecting pre-rendered component markup into a page like this causes the following problems:
data-image-card-module-started
attribute was included in the markup, which is only added after the JS has finished initialising on the component, so JS was not running on the component)For video tracking and JavaScript in general to work properly on videos they should be wrapped in a govspeak component and rendered in the page template. Pre-rendered markup for components should not be passed through from the locale files.
Why
Video tracking for GA4 was not working on this video.
Visual changes
None.
Trello card: https://trello.com/c/rHlNjPxe/775-video-tracking-not-working-on-a-b-test-pages