mikedepalma + analytics   8

How to Track JavaScript and Ajax Events with Google Analytics
Hands up if you use Google Analytics. Actually, it’s probably easier to ask who doesn’t use Analytics. Whatever your opinion of Google and its plans for world domination, Analytics is an amazing tool that has revolutionized web statistics.

For most tasks, the standard page-tracking code is adequate:

<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); // your ID/profile
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

That’s great, but what about JavaScript-heavy web applications? The most extreme examples will use a single HTML page, yet provide a range of client-side functionality, event handlers, and Ajaxy loveliness. Alternatively, you may simply want to track document downloads or other activities which do not involve a normal page load.

Identify Your Requirements
Let’s assume we’re creating a JavaScript-powered application that allows the user to search for and download free MP3s.

Note: Ecommerce Transactions
Google Analytics also provides comprehensive ecommerce tracking systems. This is more appropriate for when you’re selling items, so keep reading sitepoint.com for a tutorial coming soon.

The Category
The first data item to consider is the category—a single name for all events of a particular type. In this case, we could use “mp3system.” You could use the same category name for every event on your web page, or different categories, depending on the widget being used.

Actions
An action is a task completed by the user or, on a technical level, an activity that results in a JavaScript event being fired. For our system, we could monitor:

search (searching for a song using a key phrase)
view (viewing information about an MP3)
download (starting an MP3 download)

Labels (optional)
A label is an optional description of the action that occurred. In the case of searching, we could use the search phrase as our label. For viewing or downloading, we could apply the song ID and/or title for our label.

Values (optional)
The optional value provides a numeric quantity for the event. For MP3s, we might provide the file size or track length, so that we can report total and average download statistics. In other situations, you could record a monetary amount, or the time taken to complete an action.

The Code
That’s enough planning; let’s look at the JavaScript tracking code:

if (_gaq) _gaq.push(['_trackEvent', category, action, label, value]);

Simple. The condition first checks that we have included the Analytics JavaScript, then sends the details of the event itself. Typical events from our MP3 system might be:

_gaq.push(['_trackEvent', 'mp3system', 'search', 'good songs']);
_gaq.push(['_trackEvent', 'mp3system', 'view', 'song 1', 3456]);
_gaq.push(['_trackEvent', 'mp3system', 'download', 'song 1', 3456]);

For a file download, the simplest HTML would be:

<a href="file.mp3" onclick="_gaq.push(['_trackEvent', 'mp3system', 'download', 'file.mp3']);return true;">download</a>

Your custom event statistics should be available on Google Analytics within 24 hours. From your profile, select Content followed by Event Tracking.

Google Analytics event tracking can help you monitor user activity at a deeper level than standard page views. Are you using it for any interesting applications? Will you implement the code in your next project?

note:Want more?
If you want to read more from Craig, subscribe to our weekly tech geek newsletter, Tech Times.
JavaScript_&#38;_CSS  ajax  analytics  google  javascript  statistics  JavaScript_&_CSS 
november 2010 by mikedepalma
Use Google Analytics Advanced Segments To Find The Real Questions Your Visitors Ask
To do keyword profiling to find out what your customers are really searching for, to get into their minds and understand what it is they specifically ask, you don’t have to go far.

Your own site has all the answers – and here’s how to find them.

The 5 W’s (+ 1 H & 1 C)

Who
What
When
Where
Why
How
Can

These six words are at the heart of every conceivable question one can ask. They are the words used by searchers who want specific information; who want to see their questions answered.

You can easily find all the specific questions that led people to your site on a site-wide or page-specific level. Simply use an advanced segment that groups everyone who used one of these question words together.

Add Your Advanced Segment
You can do this manually or you can click here to add this advanced segment to your Google Analytics account.

To do it manually, click on Advanced Segments in your Google Analytics sidebar

Then click Create New Custom Segment

From the Dimensions, select Traffic Sources and drag Keywords to the drop zone.

Add one of the question words, then click Add “or” statement to continue adding more questions words.

Continue until your advanced segments conditions look like this:

Name your advanced segment (“questions” comes to mind) and save it.

Again, you can also click here to add this advanced segment to your Google Analytics account.

You can make the filter visible in as many of your profiles as you wish. Also, you can import filters from one profile to another.

Extracting The Questions
Go to the site profile you want to analyze. Let’s start at the Keywords report.

Top-right click on Advanced Segments All Visits to change it.

Select your questions segment and uncheck all visits on the right so you only see the people asking questions.

Here are some of the very specific questions people used to find our blog – what did they use to find your site?



Of course you can do the same on the page level.

Start with any of your content reports, again making sure your questions advanced segment is switched on.

Find a page and click on it. In my case I’m looking at the details page for 20 Things You Don't Know About Google.

Click on Entrance Keywords on the right.

Here are some of the very specific questions that led people to that page:

How To Use This Information

Find the frequently asked questions and create a frequently asked questions part
Pick a questions and answer it in a blog post
Look at which questions led people to a specific page. Often you’ll see the words in the questions happen to be on the page but the page itself isn’t really about the question asked. Consider writing a better page, a better post, answering that specific question.
Look at that same info again: what can you learn about how Google apparently matched the query with your page? Ever had the same experience? How can you use that to improve your site?
Spot your own problems: what are people trying to solve about your product or service? Can you improve there?
Spot other’s problems: what are people trying to deal with regarding other people’s products or services? What can you do to turn that into business for you?
What’s obvious to you but seems to be puzzling to others?

How are you going to use this information?

Post from: Search Engine People SEO BlogUse Google Analytics Advanced Segments To Find The Real Questions Your Visitors Ask--Written by Ruud Hein,
How_To  analytics  advanced_segments  google_analytics  Keyword_Research 
september 2010 by mikedepalma

Copy this bookmark:



description:


tags: