uxjoseph / gaforflash

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

Click through from Google paid add causes error on initialization #83

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Click though one a paid Google banner to the site (user)
2. Create a new instance of the GATracker object (developer)

What is the expected output? What do you see instead?
The site should function normally. Instead, during the instantiation of the 
GATracker, an error is thrown and the site is halted.

What version of the product are you using? On what operating system?
v 1.0.1.319. Happens cross browser. Happens on Windows, unsure about Mac.

Please provide any additional information below.
The stack trace for the error show it happening in 
com.google.analytics.campaign::CampaignTracker in the _addIfNotEmpy method 
called from toTrackerString. 

The code for _addIfNotEmpty is as follows:
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);
            }
            return;
        }
The first if-statement checks to see if the value object is not an empty 
string, but does not check if it is null, which causes the resulting error when 
split() is called.

The call comes from the toTrackerString method, which calls _addIfNotEmpty 
multiple times. Since the first attribute is a new array, the second a 
hard-coded string, and the last is a variable, I figure that one of this values 
must be null and is what is causing the error.

public function toTrackerString() : String
        {
            var _loc_1:Array = [];
            _addIfNotEmpty(_loc_1, "utmcsr=", source);
            _addIfNotEmpty(_loc_1, "utmccn=", name);
            _addIfNotEmpty(_loc_1, "utmcmd=", medium);
            _addIfNotEmpty(_loc_1, "utmctr=", term);
            _addIfNotEmpty(_loc_1, "utmcct=", content);
            _addIfNotEmpty(_loc_1, "utmcid=", id);
            _addIfNotEmpty(_loc_1, "utmgclid=", clickId);
            return _loc_1.join(CampaignManager.trackingDelimiter);
        }

Stack trace from when we create the new object:

TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
    at com.google.analytics.campaign::CampaignTracker/_addIfNotEmpty()[/buRRRn/projects/GAforFlash/GA_AS3/build/tmp/com/google/analytics/campaign/CampaignTracker.as:64]
    at com.google.analytics.campaign::CampaignTracker/toTrackerString()[/buRRRn/projects/GAforFlash/GA_AS3/build/tmp/com/google/analytics/campaign/CampaignTracker.as:242]
    at com.google.analytics.campaign::CampaignManager/getCampaignInformation()[/buRRRn/projects/GAforFlash/GA_AS3/build/tmp/com/google/analytics/campaign/CampaignManager.as:234]
    at com.google.analytics.v4::Tracker/_initData()[/buRRRn/projects/GAforFlash/GA_AS3/build/tmp/com/google/analytics/v4/Tracker.as:164]
    at com.google.analytics.v4::Tracker()[/buRRRn/projects/GAforFlash/GA_AS3/build/tmp/com/google/analytics/v4/Tracker.as:109]
    at com.google.analytics::GATracker/_trackerFactory()[/buRRRn/projects/GAforFlash/GA_AS3/build/tmp/com/google/analytics/GATracker.as:215]
    at com.google.analytics::GATracker/_factory()[/buRRRn/projects/GAforFlash/GA_AS3/build/tmp/com/google/analytics/GATracker.as:156]
    at com.google.analytics::GATracker()[/buRRRn/projects/GAforFlash/GA_AS3/build/tmp/com/google/analytics/GATracker.as:124]
    at extraWeightManagement.tracking::GoogleTracker/init()[C:\Projects\EXTRA_DESSERT_DELIGHTS2892\dev\site\src\extraWeightManagement\tracking\GoogleTracker.as:28]

Original issue reported on code.google.com by eric.c.decker on 9 Dec 2010 at 5:19

GoogleCodeExporter commented 8 years ago
I can confirm that this is an issue. We have a flash media player offered 
through our software and it throws the same debug error and halts execution of 
the player when the page is loaded from an Adwords redirect link. Refreshing 
the page or loading it normally gets rid of this error.

Original comment by seanhsmi...@gmail.com on 14 Jan 2011 at 7:18

GoogleCodeExporter commented 8 years ago
Has anyone found a solution for this error??? 

Original comment by rafalgad...@gmail.com on 20 Feb 2011 at 9:10

GoogleCodeExporter commented 8 years ago
Yes this is caused when the click through uses a different GA library than the 
target site. If your site is using the library available as an SWC from here 
http://code.google.com/p/gaforflash/downloads/list then the _addIfNotEmpty 
function that the campaign tracker is attempting to access does not exist. You 
must ensure your site is instead using the library available via SVN in the 
source section here http://code.google.com/p/gaforflash/source/checkout.

Original comment by firebell...@googlemail.com on 2 Aug 2011 at 12:35

GoogleCodeExporter commented 8 years ago
Looking at the library in SVN, which files am I suppose to download to correct 
this issue?

Original comment by globalin...@gmail.com on 7 Jun 2012 at 7:49

Attachments:

GoogleCodeExporter commented 8 years ago
For solution you need modify CampaignTracker.as with this fix:

        private function _addIfNotEmpty( arr:Array, field:String, value:String ):void
        {

            if( value != "" && value!=null )
            {
                value = value.split( "+" ).join( "%20" );
                value = value.split( " " ).join( "%20" );
                arr.push( field + value );
            }
        }

Original comment by arek.mat...@gmail.com on 20 Jun 2012 at 4:11

GoogleCodeExporter commented 8 years ago
I have the same error, I imported http://gaforflash.googlecode.com/svn/trunk in 
FlashBuilder, I can change CampaignTracker.as as you said, but I don't know how 
to build the SWC from it !!

Original comment by eprevo...@gmail.com on 12 Dec 2012 at 4:33

GoogleCodeExporter commented 8 years ago
I agree with you, explanations about how to build SWC from source would be 
welcomed.
Did anybody already do it?

Original comment by christophe.bismuth on 6 Mar 2013 at 9:44