Last active
December 26, 2015 22:29
-
-
Save gloriousgeneralist/7223014 to your computer and use it in GitHub Desktop.
Using jQuery for creating database outgoing links custom events. You obviously need to replace the 'a.db_name' with whatever class you wrap your database links in. If you are using this in Drupal, as I am, use instructions here to make your life easier when creating jQuery objects: https://drupal.org/node/171213#comment-4686396.
This file contains 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
<!--Database custom events--> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('a.db_name').each(function(){ | |
var db_name = $(this).text(); | |
$(this).click(function(){ | |
_gaq.push(["_trackEvent", "linkOut", "database", db_name]); // create a custom event | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment