Chief Alchemist - Business Consulting For The 21st Century Via A Holistic & Intelligent Approach
Share ChiefAlchemist.com. RSS 2.0 feed for ChiefAlchemist.com. Sign up for the mailing list. Follow Chief Alchemist on Twitter. 'Like' the Chief Alchemist's page on Facebook. See what Chief Alchemist has been Q&A'ing on Quora. Chief Alchemist bookmarks & highlights on Diigo.com. Follow the Chief Alchemist on Digg.com. Chief Alchemist channel on Last.fm. Chief Alchemist on Flickr. Mark 'Chief Alchemist' Simchock on LinkedIn. Free Initial Consultation. Email Chief Alchemist. Phone Chief Alchemist.
  • Mark ‘Chief Alchemist’ Simchock
  • 'Email me.Email => ca .at. ChiefAlchemist .dot. com
  • 'Phone me.Alchemy United => 732 997-0028
  •  
  • Free initial consultation.Free => Initial Consultation
  • Please be sure to subscribe to your communication channels of choice.
  • Click To Close => The small green (consultation), red (email) or blue (phone) icons in the top upper right.
CURRENT “TOP 10” TOPICS TOOLS CLIENTS & PROJECTS SOURCES SEARCH HIDE
Business Consulting For The 21st Century Via A Holistic & Intelligent Approach

Easy Google Analytics Events with jQuery

FYI => As somewhat of a proof of concept of a bigger & broader idea that I have brewing, I whipped up a simple and easy to implement jQuery snippet for setting up Google Analytics Event tracking. If you’re not familiar with GA Events, I’ll share a couple links over the next couple days that should help to fill in the blanks a bit.

The benefit of this approach is that it’s just a matter of adding the snippet and then adding some markup to the Events you want to track. As I mentioned, I hoping to eventually integrate this into a WordPress plugin, or similar. But let’s not worry about that right now.

Step 1—Here’s the snippet:

<script type=”text/javascript”>
$(document).ready(function() {
$(‘.EvntTrk’).click(function() {
_gaq.push([‘_trackEvent’, ‘link_out’, ‘leave_site’, $(this).attr(‘id’)]);
});
});
</script>

Step 2—If you want the click of a link to register as a GA Event, make that link’s class equal to EvntTrk. The id assigned to the link will become the GA Event Label. Set the id as you see fit.

Simple. Effective. And on point. Enjoy!

Required.
Will not be published. Required.
Please include http://