Open GoogleCodeExporter opened 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
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
Same problem when going to the site from gmail.
Original comment by malan...@gmail.com
on 25 Sep 2009 at 5:48
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
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
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
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
Original comment by zwetan
on 16 Apr 2010 at 3:22
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
Original issue reported on code.google.com by
sproutbu...@gmail.com
on 24 Feb 2009 at 12:57