mrthuanvn / gaforflash

Automatically exported from code.google.com/p/gaforflash
Apache License 2.0
0 stars 0 forks source link

Passing DebugConfiguration to GATracker does not work #80

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using version 1.0.1 of gaforflash and am trying to use a customized 
DebugConfiguration. When I create a GATracker, I pass an instance of 
DebugConfiguration to it. It should work fine, but it gives me the following 
error:

TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
    at com.google.analytics::GATracker/_factory()[/buRRRn/projects/GAforFlash/GA_AS3/build/tmp/com/google/analytics/GATracker.as:138]
    at com.google.analytics::GATracker()[/buRRRn/projects/GAforFlash/GA_AS3/build/tmp/com/google/analytics/GATracker.as:124]

Looking at the source code I've found that the debug instance variable is not 
set when passing a DebugConfiguration on the constructor. This makes the 
_factory() method fail with the error above.

I've managed to workaround this by subclassing GATracker and setting this 
variable, here is the code:

package
{
  import com.google.analytics.GATracker;
  import com.google.analytics.debug.DebugConfiguration;
  import com.google.analytics.v4.Configuration;

  import flash.display.DisplayObject;

  public class DebugGATracker extends GATracker {
    public function DebugGATracker(display:DisplayObject, account:String, mode:String="AS3", visualDebug:Boolean=false, config:Configuration=null, debug:DebugConfiguration=null) {
      this.debug = debug;

      super(display, account, mode, visualDebug, config, debug);
    }
  }
}

Any chance that this can be fixed?

Thanks,
Vicente

Original issue reported on code.google.com by vicente....@gmail.com on 15 Oct 2010 at 8:16