1 [[!template id=gitbranch branch=GiuseppeBilotta/google-analytics
2 author="[[GiuseppeBilotta]]"]]
4 I've extended the google plugin to add support for Google Analytics.
5 This is done in two steps:
7 * a `google_sitesearch` config option is introduced, to allow disabling
8 sitesearch even when the `google` plugin is loaded
9 * a `google_analytics_account` config option is introduced. When it's
10 defined, its value is assumed to be a Google Analytics account ID
11 and the corresponding JavaScript code is automatically inserted in all
12 documents. The way this is done is shamelessy stolen from the flattr
15 > Putting this in the google plugin does not seem to be a good approach.
16 > That this "functionality" is offered by the same company as google search
17 > is really of no consequence.
19 Well, my idea was to put all Google-related functionality (in the sense
20 of support for any service provided by Google) into the google plugin.
21 The alternative would have been to have one separate plugin per feature,
22 but that doesn't sound particularly nice to me. I can split it in a
23 separate plugin if you believe it's cleaner that way
25 > Also, can't this be easily accomplished by editing page.tmpl? --[[Joey]]
27 Yes, and so would flattr. But precisely because this kind of code would require
28 editing page.tmpl, doing it the manual way carries the burden of keeping it in
29 sync across Ikiwiki updates (I'm sure I don't need to mention the number of
30 help requests that essentially boil down to "oops, I was using custom templates
31 and hadn't updated them").