[TYPO3-english] (no subject)

Oliver Salzburg oliver.salzburg at googlemail.com
Mon Jan 2 11:41:10 CET 2012


On 2012-01-02 07:01, Mark Kuiphuis wrote:
> I always believe that if it can be solved with Typoscript, then it
> should be done with Typoscript and not with an extension.... :-)
> 
> I normally use the following Typoscript code to place the Google
> Analytics code on every page:
> 
> ##### START #####
> 
> temp.gakey = TEXT
> 
> [globalString = IENV:HTTP_HOST = {$HTTP_HOST_NL}]
> temp.gakey.value = {$GA_KEY_NL}
> [end]
> 
> [globalString = IENV:HTTP_HOST = {$HTTP_HOST_EN}]
> temp.gakey.value = {$GA_KEY_EN}
> [end]
> 
> [globalString = IENV:HTTP_HOST = {$HTTP_HOST_DE}]
> temp.gakey.value = {$GA_KEY_DE}
> [end]
> 
> temp.analytics = COA
> temp.analytics.10 = HTML
> temp.analytics.10.value = <script type="text/javascript">
> temp.analytics.20 = HTML
> temp.analytics.20.value = var _gaq = _gaq || [];
> temp.analytics.30 = HTML
> temp.analytics.30 < temp.gakey
> temp.analytics.30.wrap = _gaq.push(['_setAccount', '|']);
> temp.analytics.40 = HTML
> temp.analytics.40.value = _gaq.push(['_trackPageview']);
> temp.analytics.50 = HTML
> temp.analytics.50.value = (function() {
> temp.analytics.60 = HTML
> temp.analytics.60.value = var ga = document.createElement('script');
> ga.type = 'text/javascript'; ga.async = true;
> temp.analytics.70 = HTML
> temp.analytics.70.value = ga.src = ('https:' ==
> document.location.protocol ? 'https://ssl' : 'http://www') +
> '.google-analytics.com/ga.js';
> temp.analytics.80 = HTML
> temp.analytics.80.value = var s =
> document.getElementsByTagName('script')[0];
> s.parentNode.insertBefore(ga, s);
> temp.analytics.90 = HTML
> temp.analytics.90.value = })();
> temp.analytics.100 = HTML
> temp.analytics.100.value = </script>
> 
> # Add a newline character after almost any line (NOT AFTER THE unique
> pagetracker ID)
> temp.analytics.11 = HTML
> temp.analytics.11.value.char = 10
> temp.analytics.21 = HTML
> temp.analytics.21.value.char = 10
> temp.analytics.31 = HTML
> temp.analytics.31.value.char = 10
> temp.analytics.41 = HTML
> temp.analytics.41.value.char = 10
> temp.analytics.51 = HTML
> temp.analytics.51.value.char = 10
> temp.analytics.61 = HTML
> temp.analytics.61.value.char = 10
> temp.analytics.91 = HTML
> temp.analytics.91.value.char = 10
> temp.analytics.101 = HTML
> temp.analytics.101.value.char = 10
> 
> ##### END #####
> 
> In the Constants (I normally use the root page) I define the GA_KEY_LLL
> (where LLL = the language of that site)
> 
> GA_KEY_NL = UA-1234567-1
> GA_KEY_EN = UA-1234567-2
> GA_KEY_DE = UA-1234567-3
> 
> Then I build up the Google Javascript code here and put it in the <head>
> section of your document just before the </head>...(apparently this is
> new and allows it to work better and also work together with Google
> Webmaster Tools...
> 
> Of course this code can be simplified if you only have one GA account.
> Then you don't need to use the conditions to set the proper UA code...
> 
> On 27/12/11 9:55 PM, Francois Bertrand wrote:
>> I was looking around the extensions on Typo3.org and came across this
>> one:
>> http://typo3.org/extensions/repository/view/we_google_analytics/current/
>>
>> What do you think about it? Is it better to use this one or tq_seo?
>>
>> Does it work well with the latest version of T3?
> 
> Cheers, Mark

The configuration for rs_googleanalytics looks like this btw:

plugin.tx_rsgoogleanalytics {
  account       = UA-XXX
  registerTitle = title
}

Pick your favorite.


More information about the TYPO3-english mailing list