Created
April 7, 2018 15:39
-
-
Save EastSideCode/d5359b2227f193e94dae883abf0c129c to your computer and use it in GitHub Desktop.
Analytics tracking for dynamic elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(document).on('click', "a[href^='tel:']", function(event) { | |
| if (typeof gtag !== 'undefined') { | |
| gtag('event', 'Click', { | |
| 'event_category': 'Contact', | |
| 'event_label': 'Phone', | |
| 'event_callback': function() { | |
| console.log("phone tracking sent successfully"); | |
| } | |
| }); | |
| } // end if variable defined | |
| }); // end click function | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment