[aida] Add Google Analytics on site.

Вася Чайко vasya.chajko at gmail.com
Tue Sep 16 11:54:49 CEST 2008


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"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.aidaweb.si/pipermail/aida/attachments/20080916/2a37f8a2/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DefaultWebStyle-googleAnalyticsTrackingCode.st
Type: application/octet-stream
Size: 726 bytes
Desc: not available
Url : http://lists.aidaweb.si/pipermail/aida/attachments/20080916/2a37f8a2/attachment.dll 


More information about the Aida mailing list