[aida] Add Google Analytics on site.

nicolas petton petton.nicolas at gmail.com
Tue Sep 16 12:39:35 CEST 2008


Hi,

Your solution will work, but a more elegant way would be to use a component
for that, and include it where you want, for example by overriding
#pageFrame:with: in your webstyle class.

I have a GoogleAnalyticsComponent somewhere, I will share it as soon as I
find it ;)

Cheers!

Nico

2008/9/16 Вася Чайко <vasya.chajko at gmail.com>

> Hello.
>
> This my decision of a problem of addition google analytics on a site.
>
> 1. It is necessary to add one method in Class DefaultWebStyle:
>
> googleAnalyticsTrackingCode: aString
>     self app
>         addHeader: 'script'
>         value: #( 'type="text/javascript"' 'var gaJsHost = (("https:" ==
> document.location.protocol) ? "https://ssl." : "http://www.");
> document.write(unescape("%3Cscript src=''" + gaJsHost + "
> google-analytics.com/ga.js''
> type=''text/javascript''%3E%3C/script%3E"));' ).
>     self app
>         addHeader: 'script'
>         value: (Array
>             with: 'type="text/javascript"'
>             with: 'var pageTracker = _gat._getTracker("' , aString , '");
> pageTracker._initData(); pageTracker._trackPageview();').
>
> 2. In style of a site to add a method:
>
> htmlHeaderElements
>     super htmlHeaderElements.
>     self googleAnalyticsTrackingCode: 'UA-2231739-3'. "tracking code for
> site"
>     "other header elements"
>
> _______________________________________________
> Aida mailing list
> Aida at aidaweb.si
> http://lists.aidaweb.si/mailman/listinfo/aida
>
>


-- 
Nicolas Petton

http://nico.bioskop.fr
-------------- section suivante --------------
Une pi?ce jointe HTML a ?t? nettoy?e...
URL: http://lists.aidaweb.si/pipermail/aida/attachments/20080916/33f5ebf3/attachment.htm 


More information about the Aida mailing list