moutard / SubZoom-Proto1

1 stars 1 forks source link

Analytics, create a class #43

Closed rkorach closed 12 years ago

rkorach commented 12 years ago

Create a class Analytics that have listener to received message. This class handle all the analytics part. Instead of calling _.gaq each time, you just send a message to the class Analytics. and the class handle the part. It's really a betetr way, because we don't want to change all those files each time we want to change something on the analytics.

moutard commented 12 years ago

Hey take a look at the commit 372fa3ff585cfabbc4c5a61435e3251f3fc597e7

You can replace all the _.gaq by a method of the class Cotton.Analytics. See ui/sticky_bar/sticker.js l.289 for an example.

rkorach commented 12 years ago

Ok, I'll replace all the _.gaq by corresponding methods, then close the issue. Thanks for creating the class.

On Thu, Aug 9, 2012 at 1:52 PM, Raphael Moutard notifications@github.comwrote:

Hey take a look at the commit 372fa3fhttps://github.com/moutard/SubZoom-Proto1/commit/372fa3ff585cfabbc4c5a61435e3251f3fc597e7

You can replace all the _.gaq by a method of the class Cotton.Analytics. See ui/sticky_bar/sticker.js l.289 for an example.

— Reply to this email directly or view it on GitHubhttps://github.com/moutard/SubZoom-Proto1/issues/43#issuecomment-7613136.

rkorach commented 12 years ago

I have to keep the "if (bAnalytics)" statement, right?

Otherwise, if bAnalytics is false, the analytics account will not be set in ga2.js, but the _gaq.push will be called. That should bring an error, shouldn't it?

If I am right, is it better to keep the if statement in the tracked object or in the analytics class? (performance would say object, readability would say analytics class I guess..)

On Thu, Aug 9, 2012 at 2:24 PM, Raphaël Korach pink@cottontracks.comwrote:

Ok, I'll replace all the _.gaq by corresponding methods, then close the issue. Thanks for creating the class.

On Thu, Aug 9, 2012 at 1:52 PM, Raphael Moutard notifications@github.comwrote:

Hey take a look at the commit 372fa3fhttps://github.com/moutard/SubZoom-Proto1/commit/372fa3ff585cfabbc4c5a61435e3251f3fc597e7

You can replace all the _.gaq by a method of the class Cotton.Analytics. See ui/sticky_bar/sticker.js l.289 for an example.

— Reply to this email directly or view it on GitHubhttps://github.com/moutard/SubZoom-Proto1/issues/43#issuecomment-7613136.

moutard commented 12 years ago

No. the _gaq is always set, even if bAnalytics=false. So when you push there is no error, because it exists.

but if bAnalytics = false the script from google is not load so the array _gag is never loaded, it is useless. (see in the constructor init : function)

So do'nt keep, bAnalytics.

rkorach commented 12 years ago

I see, it's not a problem to push some event tracking even if there is no analytics account set. It will be stored in _gaq but never sent for analytics.

Cheers, I'm nearly done with it.

On Thu, Aug 9, 2012 at 3:15 PM, Raphael Moutard notifications@github.comwrote:

No. the _gaq is always set, even if bAnalytics=false. So when you push there is no error, because it exists.

but if bAnalytics = false the script from google is not load so the array _gag is never loaded, it is useless. (see in the constructor init : function)

So do'nt keep, bAnalytics.

— Reply to this email directly or view it on GitHubhttps://github.com/moutard/SubZoom-Proto1/issues/43#issuecomment-7615087.

rkorach commented 12 years ago

Do you prefer to put utils/ga2.js in index.html and background.html instead of utils/ga.js OR can we erase ga.js and rename ga2.js to ga.js?

On Thu, Aug 9, 2012 at 3:24 PM, Raphaël Korach pink@cottontracks.comwrote:

I see, it's not a problem to push some event tracking even if there is no analytics account set. It will be stored in _gaq but never sent for analytics.

Cheers, I'm nearly done with it.

On Thu, Aug 9, 2012 at 3:15 PM, Raphael Moutard notifications@github.comwrote:

No. the _gaq is always set, even if bAnalytics=false. So when you push there is no error, because it exists.

but if bAnalytics = false the script from google is not load so the array _gag is never loaded, it is useless. (see in the constructor init : function)

So do'nt keep, bAnalytics.

— Reply to this email directly or view it on GitHubhttps://github.com/moutard/SubZoom-Proto1/issues/43#issuecomment-7615087.

moutard commented 12 years ago

erase ga.js :)