Code Monkey home page Code Monkey logo

as3-universal-analytics's Introduction

as3-universal-analytics

Google Universal Analytics for ActionScript 3.0
(Flash / AIR / Redtamarin).

For few years people could use gaforflash to track Flash content with Google Analytics, the solution was not perfect but it did work for the general use cases.

Now, with the evolution of Google Analytics to Universal Analytics,
we can offer the Flash Platform a new library which can cover more specific and advanced use cases.

Simply put, as3-universal-analytics is an ActionScript 3 implementation of the Measurement Protocol.

Please visit the Wiki Documentation to get started.

Mission Statement

Provide a clean and complete implementation of the Measurement Protocol.

Status

First release: uanalytics v0.8

LICENSE

The Source Code is subject to the terms of the Mozilla Public License, v. 2.0 or MPL2 for short; if you have doubt or questions about this licensing please consult the MPL 2.0 FAQ.

FAQ

Q: Does it replace/update/upgrade gaforflash ?
A: Yes.

Q: Is it officially supported by Google ?
A: No.

Q: Is it officially supported by Adobe ?
A: No.

Q: What is the minimum requirement ?
A: Flash Player 11 and/or Adobe AIR 3 (October 4, 2011) and/or Redtamarin (October 25, 2014).

Q: Will it work with the Flash Player plugin as a SWF embedded in an HTTML page ?
A: Yes.

Q: Will it work when I test from Flash CS, Flash CC, Flash Builder, etc. ?
A: Yes.

Q: Will it work with AIR for mobile (iOS and Android) ?
A: Yes.

Q: Will it work with AIR for desktop (Windows and Mac OS X) ?
A: Yes.

Q: Does it have a JavaScript dependency and/or bridge mode ?
A: No. It is optional for advanced use.

Q: Will it work with Redtamarin server side (Linux and Mac OS X) ?
A: Yes.

Q: Will it work from a Linux (or Mac OS X) shell script ?
A: Yes.

Q: Will it work with Redtamarin under Windows ?
A: Not yet. It will work in a future update.

Q: Do you plan an ActionScript 2.0 version ?
A: No. Unlikely to ever happen.

as3-universal-analytics's People

Contributors

zwetan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

as3-universal-analytics's Issues

Unable to track - Error #2035

Im not able to track.

var config:Configuration = new Configuration();
config.enableErrorChecking = true;
m_universalTracker = new WebTracker( UACode, config );
m_universalTracker.pageview( "does/it/work/question-mark" );

uanalytics.swc v0.8 from zip
Using SWF in Browser.

I wasnt seeing any network call in the browser console. Then I activated the ErrorChecking.

Error: Error #2035: L'URL est introuvable. URL: http://www.google-analytics.com/collect?v=1&_v=as3uanalytics1&cid=632f2c47-aa7b-49e8-9fef-67dfb3582225&dh=localhost&dp=session%2Finit%2Fruntime%2Fweb%2Flang%2Fund%2Fmanufacturer%2FAdobe%20Windows%2Fos%2FWindows%207&ds=web&t=pageview&tid=UA-999999-3
at libraries.uanalytics.tracker.senders::LoaderHitSender/onIOError()[/Volumes/prototype/libraries/as3-universal-analytics/src/libraries/uanalytics/tracker/senders/LoaderHitSender.as:286]

Even when ForcePOST = true

Error: Error #2035: L'URL est introuvable. URL: http://www.google-analytics.com/collect
at libraries.uanalytics.tracker.senders::LoaderHitSender/onIOError()[/Volumes/prototype/libraries/as3-universal-analytics/src/libraries/uanalytics/tracker/senders/LoaderHitSender.as:286]

Do I miss something ?

support JS bridge for online SWF

so we could

  • read the analytics.js cookie and reuse it in the SWF
  • get browser informations like document encoding, referrer, etc.

update RateLimiter in all the trackers

for now the RateLimiter apply to all hit requests

according to doc it should apply to all but not item or transaction

Applies to all hits except for ecommerce (item or transaction)

Why your direct messages will be ignored on twitter / facebook / google+ / email / etc.

In the wiki main page I got a Support section that says

If you still encounter problems, and/or things do not work
please do not send me direct email or direct twitter/google+/facebook messages
Create a new issue instead.

Am I some kind of prima donna on the top of his ivory tower
that you can not even talk to me on social media ?
off course not

here why
see this question about Demographics and Interest report

If I was receiving this question by email or other direct message and answering it there
it would do 3 things

  • prevent anyone else interested by the same problem/question to see the answer
  • encourage people to keep asking their question by direct email etc.
    and so force me to copy/paste or rewrite the same answers
  • and also not showing other people that the product/library is actually used

I'm not sure why it happened on gaforflash and why it started happening again on this project

  • are people ashamed to admit they use an open source library ?
  • ashamed they still use Flash/AIR ?
  • not comfortable speaking in public ?

I really don't know, but I do know it is not efficient
it is not my goal to spend hours on direct email or messages answering 1to1 questions
my very selfish goal is to write code, the more time I can do that the more I'm happy.

In fact, sometimes it happen so often that I even thought to propose commercial support
so yeah I could teach/train/setup everything for you over as skype call etc. for a fee
but I would rather have people writing tutorial and showing each others how to setup things.

There is also a thin line: Google Analytics is a free product but it is still a business
my goal here is only to provide a library that allow you to use this free product
in a very specific context: ActionScript 3.0 with Flash and/or AIR and/or Redtamarin
but I'm not linked in any way with Google, it is not my job to promote or teach Analytics.

All that said, I can understand that people sometimes do not get what open source means,
that they just see a library as a quick tool to achieve a goal, yadda, yadda, yadda

so let me clearly state what can happen if you contact me directly

  • for a "thank you" etc. it's all cool
    I would just find it strange if you don't star the project
    but really no big deal
  • for a question or issue
    I will probably put it back here and answer it here
    keeping the author anonymous
  • for the "I need you to do something for me"
    I will probably answer with "are you ready to pay for that?"

Google Analytics reporting different number of views than NewGrounds

Hello,
I have followed the simplest implementation of the libraries:

public function sendPageview( page:String, title:String = "" ):void
{       
      var trackingID:String = "UA-XXXXX";
       var config:Configuration = new Configuration(); 
       config.forcePOST = true;
       var tracker:WebTracker = new WebTracker( trackingID, config );
       tracker.pageview( page, title );
}

It seems like the stats are not working everytime: I uploaded my game to Newgrounds last night. According to them 110 people played the game. However, Google Analytics reckons only 48 played. Is there anything I'm missing?

Thanks!

how to make simple tracker ?

Hi
I just wanted to make simple tracker for my game to know when player clicked "play" button.
I read your wiki instructions and i don't know which example should i use. I tryed to copy code from "Tracking Configuration" but i didn't manage to make it work :(

I can't get it working

I must be missing something, but I can't seem to get any data showing up in Google Analytics.

The simplest integration -
var tracker:AppTracker = new AppTracker( "UA-XXXXXX-1");
tracker.screenview("HOME");

But nothing is showing up in RealTime in Google?

I've tried sending Configuration to AppTracker to -
var config:Configuration = new Configuration();
config.forcePOST = true;
var tracker:AppTracker = new AppTracker( "UA-XXXXXX-1", config);

I've also tried setting up the two classes as detailed here - https://github.com/zwetan/as3-universal-analytics/wiki/TrackingConfiguration (MyTracker and MySender) but after instantiating MyTracker (var tracker:MyTracker = new MyTracker() ), I'm not too sure how to continue with this as trackingId doesn't exactly get applied...? Has anyone got an example project template with it working? Or No where I'm going wrong?

as3-universal-analytics implementation issue!

Hi Zwetan,

Thank you for posting this solution for tracking swf video files. I was going through the documentation for the API integration and I can follow what those steps. My issue is how to implement code inside the Flash file with a .swf format. I have found several tools to decompile the swf file but I'm not sure where to implement the code changes and how to recompile the file back and send events to Google Analytics. I would really appreciate your help. Can you please recommend me a tool to make my swf files to interact with Google Analytics?

Thank you,
Mihir

support for sessions

see Session Control parameter

few things

  • automatically add a session start for the 1st hit request
  • support timers to support session stop
  • mobile AIR app background mode shoudl trigger a session stop
  • let user trigger a manual a session stop for special cases
    like: kiosk mode, idle screens, screensavers, etc.
  • let user trigger a manual session start for special cases
    like out of idle mode, out of screensaver, etc.
  • support Session unification

see How a session is defined in Analytics

example code

This library seems perfect for what I need but I can't get it working.
Is there a complete example anywhere?

Thanks,
Matt

Flow player Flash - Would it be possible to integrate

I raised an issue in Flow Player flash to try get them to jump to universal. It looks like this library would be the ideal solution.

Would someone be able to advise how to integrate it? I personally know GA/ MPreally well, but flash is not my strong point.

How to provide credit

from caseyryan

Hey guys!
Sorry for a little off-topic, but I wanna use your lib in my mobile game, and I don't wanna be an asshole :D How do I have to provide your credits? A link to repository? Names? Or maybe some other info?
Drop me a line to this e-mail edited if you see this. If you don't, I'll provide a link to your repo
Thanks for your work!

error when trying to set sender type

iam using code from example:

var config:Configuration = new Configuration();
config.senderType = "libraries.uanalytics.tracker.senders.TraceHitSender";
var tracker:WebTracker = new WebTracker( "UA-12345-67", config );
tracker.pageview( "/hello/world", "Hello World" );

and iam getting error:
ReferenceError: Error #1065: Variable TraceHitSender is not defined.
at flash.system::ApplicationDomain/getDefinition()
at libraries.uanalytics.tracker::WebTracker/_ctor()[/Volumes/prototype/libraries/as3-universal-analytics/src/libraries/uanalytics/tracker/WebTracker.as:91]
at libraries.uanalytics.tracker::DefaultTracker()[/Volumes/prototype/libraries/as3-universal-analytics/src/libraries/uanalytics/tracker/DefaultTracker.as:135]
at libraries.uanalytics.tracker::WebTracker()[/Volumes/prototype/libraries/as3-universal-analytics/src/libraries/uanalytics/tracker/WebTracker.as:71]

Any idea what iam doing wrong ?

IOS Black Screen: Launch Failed

I have added uanalytics 0.8.0 for Air.

On launch of my app I create the Configuration and the tracker. All is ok on Android (Air27) and flash(Air28) versions.
But on IOS(Air27) the app does not start.

Note: I used Starling V1.8. FlashDevelop 5.3.

code review XML

verify that each XML node is garbage collected

eg.
System.disposeXML( node );

Client ID converter

we need a little utility function to convert from/to Client ID coming from analytics.js

see Client ID

The Client ID should be a random 64 bit integer. Historically, Google Analytics has separated its clientID into two 32-bit, unsigned, base-10 parts: 123456789.123456789. The measurement protocol supports larger UUIDs including alpha numeric characters.

Campaign tracking on Android/iOS

Does this library support campaing tracking? I mean does it support obtaining the campaign referral information via a custom referral url when the app is downloaded from GPlay/Itunes?

Thanks

Device info

Fantastic package - I am using it in a live project and mostly everything is perfect. The only problem is that the device information is not correct. All Android devices are 'unknown' and all Apple devices are 'iPodTouch'. I have some other libraries for detecting device type - where can I set these details inside the tracker?

For example, I have some code which can tell me that the device is an "iPad AIR 2" - which property inside the AppTracker can I set to this value?

How to Track two parallel screens

Hi, in my app I have two parallel screens, how can I track them the same tame?
tracker.screenview(screen1);
tracker.screenview(screen2);

in analytics Real-Time>Screens, they are rewriting each others.

Bypassing the events throttling

I noticed that GA throws away some events, especially the ones that are sent right after the screenView call. I assume the reason is the GA throttling limitation as these 2 calls are called right after each other - within 1 second.

Is there a way how to avoid this? I'm thinking of saving events into the array and sending these events one by one after some interval.

Thanks.

BTW. Huge thanks for making this library, really appreciate this.

support for Enhanced E-Commerce complex indexes

our current data model support only dynamic index at the end of the variable
see custom dimensions and custom metrics

for ex:
Custom Dimension
cd<dimensionIndex>=Sports
cd1=Sports

we support it with
tracker.set( "dimension1", "aaa" ); // cd1=aaa
and
tracker.set( Tracker.CUSTOM_DIMENSION(3), "ccc" ); // cd3=ccc

But for the most complex cases of Enhanced E-Commerce
like

Product Custom Dimension
pr<productIndex>cd<dimensionIndex>=Member
pr1cd2=123

Product Impression Custom Dimension
il<listIndex>pi<productIndex>cd<dimensionIndex>=Member
il1pi2cd3=123

where you can have 2 or 3 (more?) indexes
we don't have yet the support

AIR.SWF in-browser API

see http://help.adobe.com/en_US/air/build/air_buildingapps.pdf
for documentation

scenarios that have not been tested are

  • passing arguments from an AIR Install badge to be reused for tracking
    once the AIR application is installed
  • launching an AIR application from the browser and pass arguments for tracking
  • calling an AIR application from another AIR application and pass arguments for tracking

see also
http://archive.davidtucker.net/2008/01/10/air-tip-5-passing-arguments-to-an-application-on-install/
http://blog.pena.ro/2012/06/adobe-air-install-badge-passing-arguments-to-your-application/

ideally we would like to be able

  • make the difference between an AIR application installed from a badge.swf and from a download
  • make the difference between an AIR application launched from the browser and from the desktop

Demographics and Interest report

How to enable Demographic and Interest reports for Adobe AIR applications? What configuration and changes to tracking code are required?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.