Archive for February, 2008

02/22 Tracking Google Analytics in CMS with Event Tracking

For the purpose of this post, I am describing how to track dynamic content from a CMS system using Google Analytics and Event Tracking.

I am tying GA Event Tracking to dynamic promotional areas where the content is pulled from a Pull CMS system and rotated in sequence by an AJAX timer.    The rotating content is mixed text with some graphics and links and the client wants to track content impressions and clicks associated with the relative content depending on which content is being displayed.  All of the content is loaded into the page simultaneously and an AJAX script rotates what is being displayed.     Tricky part is that we can’t tag anything in CMS because the client changes it fairly often and you can’t embed Javascript into the content areas in this CMS.     

The first thing I did was create an Event Tracking Object for this specific dynamic area and loaded it above the dynamic content area.  I then created a function that is called when the timer function completes and displays the first content in the cycle.  The function dynamically determines which content is being displayed by searching the document for the specific div plus an array generated from the timer.  It then appends another function to all the links within that div that loads onclick (Similar to Brian Clifton’s hack for Tracking Outbound Links).  The first function also grabs the content title by id and loads it into the GA ET Label and sends the info to GA as the content rotates.  The issue I found with this is that when you try to put a JavaScript variable or HTML DOM objects into the Event Tracking label, it makes the GA Event tracking just quit.  No errors or anything, the rest of the function just quits which makes it hard to diagnose.  A way around is that ASP variables seem to work just fine so by making the javascript that pulls the title equal an ASP variable, I could then substitute the ASP variable into the label.  Now every time the content rotates, it fires a GA Event Tracking snippet that creates a “Views” action and associates the content’s title as the label.   

In order to track clicks, I use the onclick function that was appended to the links within the div that also uses an array to dynamically determine which content we are on in the cycle and fires the GA ETC with “Clicks” as the action and pulls the ASP variable again as the label.  Now when I go into GA, I can go to the Event Tracking area, view Objects, select the specific object I want and change the “Detail Level” to “Label” versus action and it displays all the dynamic content pieces within that specific Object.  I can then click on each of those and view the “Views” and “clicks” associated with each specific content piece within the given dynamic rotating CMS feature.

I might not have described this process in perfect detail but the logic is somewhat simple, implementation was a little more difficult. Even if the CMS content isn’t being rotated through a timer, you should be able to use a similar approach using Javascript to find the specific div and append either an Event Tracking or pageTracker snippet to track either views or clicks.

If you have any question, feel free to shoot me an email or post it here.

Thanks,

Brad Henry

02/04 Google Analytics Event Tracking Demo

When using Google Analytics new Event Tracking feature, when you click on an item, it produces an action. The action is then associated with a previously defined object. Each action can also associate a label such as a store or user ID. When you click on the following item it creates a test action called success!

You can see from the below snapshot that it is registering actions called success.  This is just an example but you can apply this to many other applications.  Some of the things I’ve used this in past for are tracking views and clicks of specific objects, banners, and ads.

eventtracking.jpg

You can get really creative with this and create new objects based on whatever it is you want to track and input the actions such as views and clicks then associate the average value with either of those.  You can also use it for tracking zip codes or searches people put into an object or search box on your site.  If you have a store finder on your site, you can easily determine how many people access that feature, use the feature, and know which zip codes people are searching for and the number of times for each zip code.  It’s a pretty cool feature that can be used in some creative ways.  Although Google doesn’t want personal information, you could actually use this as a system to collect and store email addresses or any other information you want to track.