drflash / gaforflash

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

Flash content with gaforflash on igoogle page throws exception #45

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile Flash content with gaforflash rev 396 (also happens in 319) with
simple AS3 mode
2. Install on igoogle home page
3. View the igoogle home page

What is the expected output? What do you see instead?
The pageview should be registered. Instead I get the following exception:
TypeError: Error #1009: Cannot access a property or method of a null object
reference.
    at
com.google.analytics.campaign::CampaignTracker/_addIfNotEmpty()[C:\lab\gaforflas
hhead\build\tmp\com\google\analytics\campaign\CampaignTracker.as:64]
    at
com.google.analytics.campaign::CampaignTracker/toTrackerString()[C:\lab\gaforfla
shhead\build\tmp\com\google\analytics\campaign\CampaignTracker.as:248]
    at
com.google.analytics.campaign::CampaignManager/getCampaignInformation()[C:\lab\g
aforflashhead\build\tmp\com\google\analytics\campaign\CampaignManager.as:234]
    at
com.google.analytics.v4::Tracker/_initData()[C:\lab\gaforflashhead\build\tmp\com
\google\analytics\v4\Tracker.as:173]
    at
com.google.analytics.v4::Tracker/trackPageview()[C:\lab\gaforflashhead\build\tmp
\com\google\analytics\v4\Tracker.as:800]
    at
com.google.analytics::GATracker/trackPageview()[C:\lab\gaforflashhead\build\tmp\
com\google\analytics\common.txt:104]
    at
com.sproutbuilder.platforms::GoogleAnalyticsPlatform/trackPageview()[/home/sprou
t/flash/mung/components/com/sproutbuilder/platforms/GoogleAnalyticsPlatform.as:4
6]
...

What version of the product are you using? On what operating system?
gaforflash rev 396 (also happens with rev319). Vista/FF3/Flash Player 10

Please provide any additional information below.
The code in Tracker.as (especially the comment at line 157) may be an
important clue.

Original issue reported on code.google.com by sproutbu...@gmail.com on 24 Feb 2009 at 12:57

GoogleCodeExporter commented 9 years ago
I was experiencing the same behavior, and I think I know the source of the 
issue.

I downloaded the source (thanks for providing this!) and started stepping 
through the
code until I found a potential error inside of the _addIfNotEmpty() function.

The original source looks like this:
private function _addIfNotEmpty( arr:Array, field:String, value:String ):void
{
  if(value != "")
  {
    value = value.split( "+" ).join( "%20" );
    value = value.split( " " ).join( "%20" );
    arr.push( field + value );
  }
}

The issue is that _addIfNotEmpty() assumes that the parameter "value" will 
never be
null (but apparently it assumes that value might be empty). I think that 
somewhere
along the code path, some of the campaign config params are set to null (since 
they
may not exist in certain contexts).

I made the following change to the function and it fixed the problem:
private function _addIfNotEmpty( arr:Array, field:String, value:String ):void
{
  if(value && value != "")
  {
    value = value.split( "+" ).join( "%20" );
    value = value.split( " " ).join( "%20" );
    arr.push( field + value );
  }
}

A simple null reference check solved all the issues I was having and as far as 
I can
tell no information is missing from the reporting (I am going to have to dig 
deeper,
and it would be nice if a google person could verify).

Just as an FYI, if anyone else wants to use this solution simply download the 
source
code from the repository (put it somewhere convenient like your project 
directory)
and add it as a classpath in your project's publish settings, make the 
recommended
change provided above (to CampaignTracker.as/_addIfNotEmpty()), and voila!

I know this is not ideal so I hope google has a solution in the next release.

Original comment by cemon...@gmail.com on 19 May 2009 at 5:07

GoogleCodeExporter commented 9 years ago
I am having exactly the same problem but if the user clicks on a link in an 
email 
read from GMail. The same link from anywere else work except from Gmail.

Here is the error(same as above):
TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
    at com.google.analytics.campaign::CampaignTracker/_addIfNotEmpty()
    at com.google.analytics.campaign::CampaignTracker/toTrackerString()
    at com.google.analytics.campaign::CampaignManager/getCampaignInformation()
    at com.google.analytics.v4::Tracker/_initData()
    at com.google.analytics.v4::Tracker()
    at com.google.analytics::GATracker/_trackerFactory()
    at com.google.analytics::GATracker/_factory()
    at com.google.analytics::GATracker()
    at com.dfc.roar.model::AnalyticsProxy()

Original comment by twistim...@gmail.com on 15 Sep 2009 at 7:19

GoogleCodeExporter commented 9 years ago
Same problem when going to the site from gmail. 

Original comment by malan...@gmail.com on 25 Sep 2009 at 5:48

GoogleCodeExporter commented 9 years ago
The same problem to me:

TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
    at com.google.analytics.campaign::CampaignTracker/_addIfNotEmpty()
    at com.google.analytics.campaign::CampaignTracker/toTrackerString()
    at com.google.analytics.campaign::CampaignManager/getCampaignInformation()
    at com.google.analytics.v4::Tracker/_initData()
    at com.google.analytics.v4::Tracker()
    at com.google.analytics::GATracker/_trackerFactory()
    at com.google.analytics::GATracker/_factory()
    at com.google.analytics::GATracker()
    at com.dfc.roar.model::AnalyticsProxy()

Original comment by flaboy....@gmail.com on 21 Oct 2009 at 10:34

GoogleCodeExporter commented 9 years ago
I made such a small change in the source in _addIfNotEmpty as cemontes described
above (Comment 1  by cemontes, May 19, 2009) and now problem dissapeared.

Original comment by flaboy....@gmail.com on 23 Oct 2009 at 9:08

GoogleCodeExporter commented 9 years ago
Thanks for the solution to this bug - I think the SWC should be updated as it's 
very
frustrating bug and had me scratching my head for a few hours!

Original comment by steve.fl...@gmail.com on 8 Dec 2009 at 11:53

GoogleCodeExporter commented 9 years ago
I get the same problem.
Anyone knows if it has been fixed in the latest SWC release?

Original comment by riccardo...@gmail.com on 15 Apr 2010 at 12:02

GoogleCodeExporter commented 9 years ago

Original comment by zwetan on 16 Apr 2010 at 3:22

GoogleCodeExporter commented 9 years ago
Hi, I have the same issue... How did you modify the _addIfNotEmpty function? it 
seems we can't modify the sources

Original comment by nathanel...@msn.com on 11 Oct 2011 at 8:26