Skip to content

TrackingDetailsAndTricks

Zwetan Kjukov edited this page Oct 6, 2015 · 25 revisions

Tracking Details and Tricks

Manually Add Parameters to a Tracker
set( field:String, value:String )
allow you to add a permanent parameter for all following hit requests.

For example add the application name:

tracker.set( Tracker.APP_NAME, "My Game" );
tracker.screenview( "High Scores" );

setOneTime( field:String, value:String )
allow you to add a "one shot" parameter for the next hit request.

For example change temporarily the data source

tracker.setOneTime( Tracker.DATA_SOURCE, "advertising" );
tracker.screenview( "Game Over" );

add( values:Dictionary )
works like the set() method but allow you to add parameters in batch from a Dictionnary of field/value pairs.

For example define the application datas:

var gameinfo:Dictionnary = new Dictionnary();
    gameinfo[ Tracker.APP_NAME ] = "My Game";
    gameinfo[ Tracker.APP_ID ] = "com.something.mygame";
    gameinfo[ Tracker.APP_VERSION ] = "1.0.0";
    gameinfo[ Tracker.APP_INSTALLER_ID ] = "Amazon App Store";

tracker.add( gameinfo );
tracker.screenview( "Intro" );

Automatically Add Parameters to a Tracker
You can use functions and/or classes helpers like:
ApplicationInfo, SystemInfo, TimingInfo, etc.
generateFlashSystemInfo(), generateAIRSystemInfo(), generateCLISystemInfo(), etc.

For example you would want to always add the System info:

var sysinfo:SystemInfo = generateFlashSystemInfo();
tracker.add( sysinfo.toDictionary() );

Or for example you would want to dynamically generate the application info from the AIR application descriptor:

var appinfo:ApplicationInfo = generateAIRAppInfo();
tracker.add( appinfo.toDictionary() );

Throttling
Our library as3-universal-analytics may throttle events, as well as other hits, if a large number of send calls are made in a short period of time.

By default our trackers use a RateLimiter

  • Online SWF files (equivalent to analytics.js)
    the WebTracker starts with 20 hits
    that are replenished at a rate of 2 hits per second.
  • AIR applications (equivalent to Android SDK/iOS SDK)
    the AppTracker starts with 60 hits
    that are replenished at a rate of 1 hit every 2 seconds.
  • RedTamarin (command-line and server-side)
    the CliTracker starts with 100 hits
    that are replenished at a rate of 10 hits per second.

Sampling
By default our trackers use a sample rate of 100%, that means all hits are send, but then if your sites or apps reach millions of users you might consider sampling down your data to maybe 40% more or less.

By sampling the hits for your site or app, you will still get reliable report results while staying within the hit limits for your account.

see: How sampling works

Session Management

By default, Google Analytics will group hits that are received within 30 minutes of one another into the same session. This period is configurable at the property level.

see: Learn how to configure this session timeout period

Manual Session Management
You can manually start a new session when sending a hit to Google Analytics.

The following example shows how to start a new session when sending a screen view:

tracker.setOneTime( Tracker.SESSION_CONTROL, SessionControl.START );
tracker.screenview( "Home Screen" );

Automatic Session Management
Not supported yet.

Pages

Screens

Events

Timing

Exceptions

Custom Dimensions and Metrics

E-commerce

Note:
Our trackers can track E-Commerce Transaction and Item but it seems those will be deprecated in favour of Enhanced E-Commerce which uses more complex parameters that we don't support yet.

In fact, analytics.js need to load an additional ecommerce.js, see Ecommerce Tracking.

We may not support that at all as our focus is on the Measurement Protocol.

Clone this wiki locally