The WP Google Analytics Events Pro plugin features two ways for tracking link clicks:
1. Globally enable link tracking (recommended)
2. Per link tracking
Tracking Links Globally
- Track All Links on your website
- Track only External Links
- Track links that belong to a specific class
The benefit of this feature, is that you don’t have to go over manually and set events for the links.
Each event will include the name of the page that the link was on (category), Link as the action, and the destination url as the label.
Per link configuration
Adding monitoring to a link click event is simple. Use the shortcode or manually add the html class and attributes to the link:
<a href='http://www.google.com' class='clickevent' data-event-cat='Outgoing' data-event-action='click' data-event-label='google.com' >Google </a>
Monitoring link clicks with google analytics requires special attention.
When the link is pressed, the ajax call to google’s server may be interrupted and no event will be logged by the system.
Our solution to this problem is to add a short delay between the user click and the redirect action. The longer the delay the safer we are with the data.
By default, the delay is disabled and set to 0ms.
To enable this delay, set the “Add delay to link clicks” option to your desired delay: