ActiveDen

SWFAddress + Google Analytics

1954 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Netherlands
  • Referred between 10 and 49 users
  • Sold between 5 000 and 10 000 dollars
Emroni says

Ive had a few problems with it in the past few hours, so I thought Id share my findings so you wont have to search for it.

With the new GA and SWFAddress 2.4, the GA tracking through SWFAddress doesnt work anymore. Thats because the ‘pageTracker’ that SWFAddress uses no longer exists. All you would have to do to make it work is to add the following line at the end of the GA script:

var pageTracker = {    _trackPageview: function (url) {_gaq.push (['_trackPageview', url ]);}}; 

This creates that ‘pageTracker’ that SWFAddress needs to track through GA. So now it looks like this:

<script type="text/javascript">
          var _gaq = _gaq || [];
          _gaq.push(['_setAccount', 'xx-xxxxxxxx-x']);
          _gaq.push(['_trackPageview']);
          (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript';
        ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
        'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(ga, s);
          })();

        // Tracker for SWFAddress
        var pageTracker = {    _trackPageview: function (url) {_gaq.push (['_trackPageview', url ]);}}; 
</script>

And thats it! Hope that helps someone some day :)

4126 posts
  • Bought between 1 and 9 items
  • Brazil
  • Community Superstar
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
  • Sold between 5 000 and 10 000 dollars
tsafi says

i didn’t know that ,thanks Dutch man :P

158 posts
  • Bought between 1 and 9 items
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Has been a member for 4-5 years
  • Portugal
  • Sold between 1 000 and 5 000 dollars
theRiviera says

Thank you Emroni. Appreciate it!

2079 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 10 and 49 items
  • Referred between 200 and 499 users
  • Has been a member for 4-5 years
  • Won a Competition
+10 more
mpc moderator says

Hi thank you for the fix, I would like to blog it do you have anything against that ? :)

1954 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Netherlands
  • Referred between 10 and 49 users
  • Sold between 5 000 and 10 000 dollars
Emroni says

Youre all very welcome

Nothing against that Kuba, go ahead :)

1518 posts
  • Bought between 1 and 9 items
  • Europe
  • Exclusive Author
  • Has been a member for 5-6 years
  • Referred between 100 and 199 users
  • Sold between 50 000 and 100 000 dollars
dSKY says

thanks for the info !

3575 posts
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Exclusive Author
  • Beta Tester
  • Has been a member for 3-4 years
  • Spain
+3 more
pezflash says

Thanks Emroni. Good to know.

146 posts
  • Bought between 100 and 499 items
  • Has been a member for 5-6 years
  • Referred between 10 and 49 users
  • Sold between 10 000 and 50 000 dollars
  • United States
CodeByASH says

Same here!

Thanks

92 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • United States
scriptonomy says

Look like a good hack, however I would be hesitant to mess with GA code per Google’s terms of use policies. I would love to know your thoughts on this subject.

1954 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Netherlands
  • Referred between 10 and 49 users
  • Sold between 5 000 and 10 000 dollars
Emroni says

^ Well, its not really messing with their code. All you do is add a line so you can use their code, your not changing anything. What this line does is make sure that SWFAddress can use the GA code, nothing wrong with that.

by
by
by
by
by