Reputation: 1153
In my Django app I've this button when clicked is directed to a google map. I'd like to track this button using Google Analytics and Mixpanel.
<div id="map-button">
<a class="active" id="nav" target="_blank" itemprop="hasMap" href="https://www.google.com/maps/place/{{doctor.clinic.geolocation}}"><button id="gmap" class="button"><h5>View on Google Maps</h5></button></a>
</div>
Upvotes: 1
Views: 577
Reputation: 8907
One possibility is to add a click event listener that fires a GA event whenever a click is registered. You could add the following onclick code to your anchor tag:
onclick="ga('send', 'event', 'Google maps', 'click');"
Upvotes: 2