<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Krotscheck.net &#187; metrics</title>
	<atom:link href="http://www.krotscheck.net/tag/metrics/feed" rel="self" type="application/rss+xml" />
	<link>http://www.krotscheck.net</link>
	<description>Michael Krotscheck's insights, ideas, and inspirations about web technology, life, and the kitchen sink.</description>
	<lastBuildDate>Fri, 03 Feb 2012 05:10:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Using the Metrics Package to record Flash Application Analytics</title>
		<link>http://www.krotscheck.net/2008/02/14/using-the-metrics-package-to-record-flash-application-analytics.html</link>
		<comments>http://www.krotscheck.net/2008/02/14/using-the-metrics-package-to-record-flash-application-analytics.html#comments</comments>
		<pubDate>Thu, 14 Feb 2008 18:11:09 +0000</pubDate>
		<dc:creator>Michael Krotscheck</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[omniture]]></category>
		<category><![CDATA[urchin]]></category>

		<guid isPermaLink="false">http://www.practicalflash.com/articles/using-the-metrics-package-to-record-flash-application-analytics/</guid>
		<description><![CDATA[<p>Web analytics is a way in which individual visitor action can be easily tracked within a site, and the aggregate statistical data derived from this can often lend remarkable insights into the effectiveness of your design, how 'sticky' your content is, and what your users are actually looking for. Unfortunately, extending this paradigm into flash has always been tricky, because it doesn't adhere to the page-based paradigm on which most Analytics packages are built. Once a flash application or widget is loaded, the server loses most knowledge about what the user is actually doing within it.</p>
<p>Usually this isn't really a problem- flash applications have not been too complex and not many people care where on the banner you clicked, just that you left the site as a result. Yet now with the strong growth of Flex and Ajax our web applications are becoming more and more complex, and marketers and usability experts are now demanding this tracking data in spite of the paradigm limitations.</p>
<p>If you really think about it, what we really are interested in tracking is a user action, rather than the page loads we are collecting right now, which means that the largest part of an analysts job is turning these page events into meaningful user actions, rather than interpreting those users. There's been some attempt to set metrics to individual places within a page flow, yet nobody has yet thought to rethink the paradigm. But I digress...</p>
<p>Most Metrics providers have since opened their API's enough to allow a developer to pretend like a new page refresh has occurred. While this is hardly optimal, it does allow us to track user events from inside of flash, but the fact that each provider has implemented their API a different way means that implementing metrics for each is still a string of unique problems to solve.</p>
<p>To that end I've written the Metrics package, which is intended to provide a common metrics proxy that any developer may use, which relies on a common library of connectors that can be swapped out as needed. In this article I go over the details of how to use it, and touch on how individual connectors might be written.</p>]]></description>
			<content:encoded><![CDATA[<p>Web analytics is a way in which individual visitor action can be easily tracked within a site, and the aggregate statistical data derived from this can often lend remarkable insights into the effectiveness of your design, how &#8216;sticky&#8217; your content is, and what your users are actually looking for. Unfortunately, extending this paradigm into flash has always been tricky, because it doesn&#8217;t adhere to the page-based paradigm on which most Analytics packages are built. Once a flash application or widget is loaded, the server loses most knowledge about what the user is actually doing within it.</p>
<p>Usually this isn&#8217;t really a problem- flash applications have not been too complex and not many people care where on the banner you clicked, just that you left the site as a result. Yet now with the strong growth of Flex and Ajax our web applications are becoming more and more complex, and marketers and usability experts are now demanding this tracking data in spite of the paradigm limitations.</p>
<p>If you really think about it, what we really are interested in tracking is a user action, rather than the page loads we are collecting right now, which means that the largest part of an analysts job is turning these page events into meaningful user actions, rather than interpreting those users. There&#8217;s been some attempt to set metrics to individual places within a page flow, yet nobody has yet thought to rethink the paradigm. But I digress&#8230;</p>
<p>Most Metrics providers have since opened their API&#8217;s enough to allow a developer to pretend like a new page refresh has occurred. While this is hardly optimal, it does allow us to track user events from inside of flash, but the fact that each provider has implemented their API a different way means that implementing metrics for each is still a string of unique problems to solve.</p>
<p>To that end I&#8217;ve written the Metrics package, which is intended to provide a common metrics proxy that any developer may use, which relies on a common library of connectors that can be swapped out as needed. In this article I go over the details of how to use it, and touch on how individual connectors might be written. You can access and <a href="http://www.krotscheck.net/libraries/package-metrics/">download the actual library here</a>.</p>
<h3>Step 1: Initialize the Metrics Engine</h3>
<p>The first step is to initialize the metrics controller with the connectors you&#8217;d like it to use.</p>
<pre>
import com.practicalflash.metrics.connectors.GoogleConnector;
import com.practicalflash.metrics.connectors.UrchinConnector;
import com.practicalflash.metrics.Metrics;

// Add the connectors
Metrics.addConnector( com.practicalflash.metrics.connectors.GoogleConnector);
Metrics.addConnector( com.practicalflash.metrics.connectors.UrchinConnector);
</pre>
<p>Note that the package can take an arbitrary number of connectors, yet will only instantiate those which successfully autodetect their environment. Should you want to deploy an application and don&#8217;t know in advance what environment you&#8217;ll be reporting to, you can hedge your bets and add several, as I have above. The only caveat is that any provided class must implement the IMetrics interface.</p>
<h3>Step 2: Dispatch a Metrics Event</h3>
<p>Once you&#8217;ve initialized your connector, you may dispatch metric events from any point in the application by creating a MetricsEvent object. The following example demonstrates a case where you might have an event listener waiting for a particular user action.</p>
<pre>
import com.practicalflash.metrics.MetricsEvent;

function someEventHandler( event : Event ) : void
{
        var metricEvent : MetricsEvent = new MetricsEvent("/this/is/a/test.html?foo=bar");
        metricEvent.dispatch();
}
</pre>
<p>Additional options include setting the event type, the dispatching target, or adding an arbitrary number of parameters to be parsed and passed along. Exact behavior for these parameters is described in the documentation, and may be dependent on their level of support within the various connectors.</p>
<pre>
metricEvent.target = event.target;
metricEvent.type = MetricsEvent.RECORD;
metricEvent.addParameter( "bar" , "foo" );
</pre>
<h3>Further Customization</h3>
<p><span style="font-size: 12px; font-weight: normal;">If any of the provided connectors don&#8217;t suit your purpose, the task of writing your own is actually fairly simple. The only requirement for the connector is that it implements the IMetrics interface, which prescribes two functions: detect(), which runs any autodetection script you&#8217;d care for, and send(), which should process and deliver any received information appropriately.</span></p>
<p>Additionally, the AbstractConnector class is provided with a few useful utility features, including a singleton instance of the JavascriptConnector (accessible via the jsBridge parameter) as well as getDOMBounds(), which returns an objects&#8217; rectangular bounds with respect to the HTML DOM (just in case your metrics package supports the reporting of a page&#8217;s click area).</p>
<p>A sample connector might be as simple as the following:</p>
<pre>
package com.practicalflash.metrics.connectors
{
        import com.practicalflash.metrics.MetricsEvent;
        import com.practicalflash.metrics.interfaces.IMetrics;

        public class UrchinConnector extends AbstractConnector implements IMetrics
        {
                public function detect() : Boolean
                {
                        if( available )
                                return jsBridge.hasParameter( "urchinTracker" );
                        else
                                return false;
                }

                public function send( event : MetricsEvent ) : void
                {
                        jsBridge.urchinTracker( event.page + "?" + event.getURLString() );
                }
        }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.krotscheck.net/2008/02/14/using-the-metrics-package-to-record-flash-application-analytics.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Package: Metrics</title>
		<link>http://www.krotscheck.net/2008/02/14/package-metrics.html</link>
		<comments>http://www.krotscheck.net/2008/02/14/package-metrics.html#comments</comments>
		<pubDate>Thu, 14 Feb 2008 16:26:57 +0000</pubDate>
		<dc:creator>Michael Krotscheck</dc:creator>
				<category><![CDATA[Libraries]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[omniture]]></category>
		<category><![CDATA[urchin]]></category>

		<guid isPermaLink="false">http://www.practicalflash.com/libraries/package-metrics/</guid>
		<description><![CDATA[<p>The Metrics package was designed to provide a simple, reusable, extensible and flexible interface to any web metrics package, including Google Analytics, Urchin, Omniture, WebTrends and more. It supports multiple connector management, instantiating only those registered connecters that are successful at autodetecting their environment. If a developer does not know in advance which metrics package his client is using (or whether his client might change his mind at a later time), he may safely add several connectors secure in the knowledge that the package will do the heavy lifting. Additional functionality allows you to "hot-swap" connectors should that become necessary, though I myself don't exactly know why you'd want to do that.</p>
<p>At this point in time, the only connector published with this library is the UrchinConnector. Google Analytics and WebTrends will follow shortly, however due to my employers' client agreements I find it prudent to not release connectors for API's that are considered proprietary (such as Omniture) unless I have a formal letter granting me legal permission to do so.</p>]]></description>
			<content:encoded><![CDATA[<table class="package">
<tbody>
<tr>
<th>Package</th>
<td>com.practicalflash.metrics.*</td>
</tr>
<tr>
<th>Download</th>
<td>[<a href="http://www.krotscheck.net/libraries/Metrics.tar.gz">tar</a>] [<a href="http://www.krotscheck.net/libraries/Metrics.zip">zip</a>]</td>
</tr>
<tr>
<th>Source</th>
<td><a href="http://code.google.com/p/practicalflash/">Google Code Repository</a></td>
</tr>
</tbody>
</table>
<p>The Metrics package was designed to provide a simple, reusable, extensible and flexible interface to any web metrics package, including Google Analytics, Urchin, Omniture, WebTrends and more. It supports multiple connector management, instantiating only those registered connecters that are successful at autodetecting their environment. If a developer does not know in advance which metrics package his client is using (or whether his client might change his mind at a later time), he may safely add several connectors secure in the knowledge that the package will do the heavy lifting. Additional functionality allows you to &#8220;hot-swap&#8221; connectors should that become necessary, though I myself don&#8217;t exactly know why you&#8217;d want to do that.</p>
<p>At this point in time, the only connector published with this library is the UrchinConnector. Google Analytics and WebTrends will follow shortly, however due to my employers&#8217; client agreements I find it prudent to not release connectors for API&#8217;s that are considered proprietary (such as Omniture) unless I have a formal letter granting me legal permission to do so.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.krotscheck.net/2008/02/14/package-metrics.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

