docs icon indicating copy to clipboard operation
docs copied to clipboard

Idea: track clicks on "Improve this document" links

Open SeanKilleen opened this issue 3 years ago • 1 comments

An idea I wanted to write up before I lose it.

We have a link on all our articles to improve it. It goes to GitHub where someone can edit the file.

I'd like to track the number of times people click on that link, so that we get a sense of where people might be confused, even if they don't show us that feedback. We should be able to see this by page.

Since we're using google analytics, we should be able to wire up an event to fire when the link is clicked. I'll need to look into how to do it.

SeanKilleen avatar Sep 11 '21 18:09 SeanKilleen

To do this, I think we would want to make use of jQuery that already comes with the docs site and wire up a button click to google analytics.

Our contribution link is rendered with the contribution-link class, so it would be something like:

// Attach click listener to relevant buttons.
jQuery('.contribution-link').click(function() {
  // This function reports an event to Google Analytics servers.
  ga('send', 'event', 'Improve Doc Link Clicked', 'click', 'Improve this Doc');
});

Need to figure out how to reference the custom script and get it added and then I should be good to implement this.

SeanKilleen avatar Feb 13 '23 15:02 SeanKilleen