Add Google Analytics onclick tracker to WSL elements
-
The WSL version we are currently using is 2.3.0.
I want to add a google analytics onclick event tracker to the my social widget elements so that we can analyze the number of people are clicking these sign up methods. Currently, the modal that pops up renders on page load in footer.php. In a separate JS file,I tried to target the Facebook widget, for example, by doing:
$(document).ready(function() {
$(“.tbf-modal-join a.wp-social-login-provider.wp-social-login-provider-facebook”).attr(‘onlick’, ‘ga(‘send’, ‘event’, ‘Navigation’, ‘WSL-Facebook’);
})
})This however, didn’t work for me (as well as numerous other variations of classes, attributes, e.g. ‘setAttribute’ instead of attr).
Could anyone please suggest how this could be done?
Thanks!
- The topic ‘Add Google Analytics onclick tracker to WSL elements’ is closed to new replies.