Skip to content
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

Ash changes #21

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Ash changes #21

wants to merge 4 commits into from

Conversation

AshGDS
Copy link
Collaborator

@AshGDS AshGDS commented Nov 22, 2023

What

  • Improve the chrome/chromedriver docs - it turns out it's no longer tied to your actual version of Chrome, you can install a test version of Chrome and chromedriver so your versions will never become mismatched.
  • Added the ability for the robot to track main content link clicks. The only example I've added is the homepage. This uses event.preventDefault() so that the browser doesn't actually navigate to the link when it clicks it. (see screenshot 1)
  • Improved the See all events page which shows you all the events for a given page. This wasn't working properly because it looked for our old data attribute, data-ga4. Now it looks for data-ga4-event, data-ga4-link, and data-ga4-form to find elements to click. Each event object is now collapsed by default as well, and has a title which helps show what it is (see screenshot 2).
  • I also moved away from using Selenium for link clicks on that page. This is because Selenium errors when it tries to click something that is hidden, and there are a lot of hidden links on our pages e.g. within the header. With JavaScript, we can still click on the links when they are hidden to extract their GA4 data.

Main content link clicks

image

'See all events' page

image

Also adds VPN notice to the homepage
Uses JavaScript for click events instead as selenium does not interact with hidden elements but JavaScript does.
@@ -1,7 +1,7 @@
class HomeController < ApplicationController
def index
@interaction_types = ApplicationController.helpers.interaction_types
@environments = %w[gov.uk staging.publishing.service.gov.uk integration.publishing.service.gov.uk]
@environments = %w[integration.publishing.service.gov.uk staging.publishing.service.gov.uk gov.uk]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I swapped these around, just so that integration is the default option on the form - so production isn't spammed with data

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

Successfully merging this pull request may close these issues.

1 participant