I am attempting to use Event tracking in Google Analytics. In order to achieve this I need to add an onclick attribute to certain links (The ones I was asked to track) like so:
<a href="http://www.example.com" onclick="trackOutboundLink('http://www.example.com'); return false;">Check out example.com</a>
The CMS I am using does not have an option to add onclick events to the menu and I don't want to track every link in the main navigation. I only have a beginner's level understanding of javascript, but I have been looking for a way to use it to insert the onclick status above to only certain href values.
Any assistance would be greatly appreciated.
”
- replace to"
and'
accordingly.