GithubHelp home page GithubHelp logo

Comments (8)

grantkemp avatar grantkemp commented on August 21, 2024

It actually looks pretty easy to do as the code is structured nicely.

I think I can do a fix easilty and share it back. How Do I compile just the SWF plugin for analytics? I can't see anything in the readme for the project or in the Flowplayer docs.

from flash.

danrossi avatar danrossi commented on August 21, 2024

They use the swc libraries of the GA code.

Original project was here

https://code.google.com/archive/p/gaforflash/

New project

https://github.com/zwetan/as3-universal-analytics

from flash.

grantkemp avatar grantkemp commented on August 21, 2024

@danrossi ah - good shout. Is that big thing to do ? I was looking at doing it via the Bridge instead of using Measurement protocol.

It sounds like it would be the easiest option and ideal just to update the flash plugin to use universal as you say above.

from flash.

grantkemp avatar grantkemp commented on August 21, 2024

Just had a look - and unfortunately flash is not my strong point.
I know GA and Measurement protocol really well - so I can advise on the implementation if someone can do the Flash piping.

from flash.

zwetan avatar zwetan commented on August 21, 2024

by quickly looking at the sources it seems the analytics is done trough a plugin
https://github.com/flowplayer/flash/tree/master/plugins/analytics

I would suggest to create another analytics plugin (maybe? I'm not sure)
keeping the same structure/logic
but replacing com/google/analytics packages with the ones of as3-universal-analytics

then you would have to change the logic and api calls in org/flowplayer/analytics
(maybe another name? org/flowplayer/uanalytics or whatever to not confuse the 2 plugins)

in the main class GoogleTracker (maybe rename that too?)

for example

import libraries.uanalytics.tracking.AnalyticsTracker;
import libraries.uanalytics.tracker.WebTracker;

public class GoogleTracker extends Sprite implements Plugin {

//...
private var _tracker:AnalyticsTracker; // ideally use the interface

private function instantiateTracker():void {

    try {
        _tracker = new WebTracker( "UA-12345-67" ); // for web
        //_tracker = new AppTracker( "UA-12345-57" ); // for AIR
        // or any custom tracker/sender that implement the interface

        // more logic if needed

    } catch(e:Error) {
        _model.dispatchError(PluginError.ERROR, "Unable to create tracker: " + e);
    }
}

}

private function doTrackEvent(eventName:String, trackViewDuration:Boolean = false, event:ClipEvent = null):void {

    if (_tracker == null) {
        instantiateTracker();
    }

    var clip:Clip = Clip(event ? event.target : _player.currentClip);
    var time:int = trackViewDuration ? (_viewDurationMillis / 1000) : int(_player.status ? _player.status.time : 0);

    // follow the doc from the interface 
    // eg. event( category:String, action:String, label:String = "", value:int = -1 ):Boolean;
    _tracker.event( category, eventName, clip.completeUrl + (clip.isInStream ? ": instream" : ""), time );
}

see interface libraries.uanalytics.tracking.AnalyticsTracker

from that it's writing logic for the configuration and other custom settings you may need.

from flash.

danrossi avatar danrossi commented on August 21, 2024

It seems it needs a complete refactor to use the new library.

from flash.

zwetan avatar zwetan commented on August 21, 2024

it is a different library implementing a different protocol
even if it is still Google Analytics

from flash.

grantkemp avatar grantkemp commented on August 21, 2024

yes I tried to have a go this weekend.

so far after about 5hours, ihave got my head round it but am fighting against my lack of knowledge on flash to really progress.

i think the ideal method - is just to update the _gaq calls and change them to ga( calls via the Javascript bridge until someone who knows more flash can find time to update.

from flash.

Related Issues (20)

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.