department-of-veterans-affairs / va.gov-cms

Editor-centered management for Veteran-centered content.
https://prod.cms.va.gov
GNU General Public License v2.0
99 stars 69 forks source link

Mobile Footer: accordion expansion does not fire analytics click event on some pages #11262

Open jilladams opened 2 years ago

jilladams commented 2 years ago

Description

The mobile footer should fire a Google Analytics event when user clicks to expand an accordion. This GA event is correctly firing on VA.gov mobile view, for example (screenshots below)

On Healthcare appt pre-check in and check-in error pages, this event is not firing. e.g.

To reproduce (Need input from Product)

Success case:

Failure case:

Screenshots

1st one shows the event fire on VA.gov and the 2nd is for the check-in page and you can see there is no accordion expand event.

No click event firing on translated pages: ![image (18)](https://user-images.githubusercontent.com/85581471/196755437-4a57c8b4-5c60-49a4-8c2a-8983a0466c12.png)
On standard page: click event fires ![image (17)](https://user-images.githubusercontent.com/85581471/196755480-b961a874-496d-4d42-a6bb-bdf3a470a27f.png)

Acceptance Criteria

wesrowe commented 2 years ago

@ryguyk, this was raised by the Check-in team. Tagged you for pre-refinement if you have time.

wesrowe commented 2 years ago

Update: Per Ben Brasso this is not impeding their work. That translates to low priority for PW team.

benbrasso-agile6 commented 2 years ago

Thanks. Following

ryguyk commented 2 years ago

This does not appear at first glance to be configured in code. I think it might be configured in Google Tag Manager (GTM). Do we have or can we get access?

wesrowe commented 2 years ago

@wesrowe refer to Michelle Dooley for consultation

wesrowe commented 2 years ago

@michelle-dooley, you sent this issue to Public Websites originally – please see above, we think this might be a GTM config issue. What's the next step?

michelle-dooley commented 2 years ago

@wesrowe and @ryguyk - this event is driven by web components that are already configured in GTM and working across other pages, so the GTM work is done, this needs FE code implementation on those 2 pages for event: int-accordion-expand and int-accordion-collapse.

image

image

ryguyk commented 2 years ago

Let me take a deeper look at this. My commentary above was based on an extremely brief initial dive. I had not previously engaged with these analytics.

ryguyk commented 2 years ago

Thanks @michelle-dooley for the additional information.

@wesrowe I've got my head around this more clearly now.

Importantly, this problem potentially goes beyond our team's purview. It might not be our issue to solve.

That said, in order to help figure out if that might be the case, I've done a little leg work to understand the issue better and outline a potential solution.

Problem details

These analytics events are set up to fire on all of our statically generated pages (i.e. pages from Drupal). They are not set up to fire on React apps (i.e. there are many more pages/apps than those initially flagged in this issue where these events are not firing).

The reason that this works on static pages but not React apps is because static-pages-entry.js calls subscribeAccordionEvents. It's very useful to note here that the accordion being used in the mobile footer is not the web component <va-accordion>. It's a Formation accordion, and that element is the one that gets wired up with the call to subscribeAccordionEvents. That function is not called from React apps.

Potential solution paths

  1. Call subscribeAccordionEvents individually in each app that needs this functionality.
  2. Call subscribeAccordionEvents at a higher level that is common to all apps.

On the surface, option 2 seems like the more complete approach, but I'd like to pick the brains of some engineers who are a bit more familiar with the architectural implications (i.e. Platform). The fix would not be a particularly heavy lift regardless. It just might call for a discussion with - and potentially an implementation by - the Platform team.