anvilproject / anvil-portal

The NHGRI Analysis Visualization and Informatics Lab-space (AnVIL) website
https://anvilproject.org/
MIT License
2 stars 20 forks source link

Update tracking of outbound links to include all link types #3386

Open MillenniumFalconMechanic opened 1 week ago

MillenniumFalconMechanic commented 1 week ago

Need

Currently, only "true" outbound links are being tracked by GTM and not mocked links such as the links to the Catalog and Explorer. All outbound links, true and mocked, must be tracked.

Approach

jpaten commented 1 week ago

@MillenniumFalconMechanic Will do on the first point - I'm going to make a checklist in the next comment so we can track it more easily, since this will require deploying a new version across multiple configs

On the second point, I don't think we can simply update trigger - outbound_link_click to fire on "All Elements", because this trigger does not seem to reliably track each click. To test, I added a tag/trigger that fires on all "Click - Just Links" event and a tag/trigger that fires on all "Click - All Elements". In some cases, such as clicking the "Beta Announcement" link, only "Click - Just Links" records a click url: (also, having both tags fire on each link seems to cause the current url to be recorded improperly, I'm not sure why since I didn't observe that before this test)

Image Image Image

Clicking the image links in the footer also causes unexpected behavior:

Image Image Image

Most frustrating-ly, there are also mocked links that aren't tracked using "Click - Just Links", but that also don't get a url recorded for "All Elements"

Image Image

And in contrast, there are mocked links that work for both Image Image Image

So I'm not entirely sure what to make of this. ChatGPT said the best strategy would be to create a custom event that fires on all clicks, but I think implementing that for the various different sorts of mock links would be complex, and a very quick google search didn't find anything promising. Let me know if you have any tips, sorry that this is such a wall of text!

jpaten commented 1 week ago

Rename Tracker: