Add the onclick attribute to all external links, either using some javascript to iterate through all the <a> elements on the page, or by adding a new feature to BlackFriday
Questions I’d like to discuss before I open an Issue or PR:
Should outbound link tracking be implemented as a feature in Hugo? (or let people implement it in themes)
If implemented as a feature in Hugo, should it be enabled by default? (iff GA is enabled)
What’s the best way to add the onclick attribute to external links? (javascript - quick and easy to implement but will impact page loading; or BlackFriday - much more elegant, but requires changes to BlackFriday)
I don’t think it should since I estimate that only a small subset of people have a need to track outbound links.
Isn’t it much easier to add the Google Analytics snippet yourself if you want to make customisations? I never use the Hugo internal templates because adding the tracking code myself is super quick and allows for lots of customisations.
I also think it will be good if Hugo’s internal templates for Google Analytics cover just the basics. Otherwise we’d have feature requests for setting a custom site speed sample, implementing the anonymizeIp feature, or tracking the custom bounce rate.
My point: there’s a lot we can do with Google Analytics, and as site developers we probably do, but this is not the stuff we should expect from Hugo core. But that are just my 2 cents.
I agree that Hugo’s implementation of GA should be the simple plain vanilla. It’s really not hard to do on one’s own. As something of an aside, this looks like a neat implementation: https://github.com/googleanalytics/autotrack