Index: trunk/extensions/googleAnalytics/googleAnalytics.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | $wgExtensionCredits['other'][] = array( |
8 | 8 | 'path' => __FILE__, |
9 | 9 | 'name' => 'Google Analytics Integration', |
10 | | - 'version' => '2.0.1', |
| 10 | + 'version' => '2.0.2', |
11 | 11 | 'author' => 'Tim Laqua', |
12 | 12 | 'description' => 'Inserts Google Analytics script (ga.js) in to MediaWiki pages for tracking.', |
13 | 13 | 'descriptionurl' => 'googleanalytics-desc', |
— | — | @@ -16,11 +16,21 @@ |
17 | 17 | $wgExtensionMessagesFiles['googleAnalytics'] = dirname(__FILE__) . '/googleAnalytics.i18n.php'; |
18 | 18 | |
19 | 19 | $wgHooks['SkinAfterBottomScripts'][] = 'efGoogleAnalyticsHookText'; |
| 20 | +$wgHooks['ParserAfterTidy'][] = 'efGoogleAnalyticsASAC'; |
20 | 21 | |
21 | 22 | $wgGoogleAnalyticsAccount = ""; |
| 23 | +$wgGoogleAnalyticsAddASAC = false; |
22 | 24 | $wgGoogleAnalyticsIgnoreSysops = true; |
23 | 25 | $wgGoogleAnalyticsIgnoreBots = true; |
24 | 26 | |
| 27 | +function efGoogleAnalyticsASAC( &$parser, &$text ) { |
| 28 | + global $wgOut; |
| 29 | + |
| 30 | + if( !empty($wgGoogleAnalyticsAccount) && $wgGoogleAnalyticsAddASAC ) { |
| 31 | + $wgOut->addScript('<script>window.google_analytics_uacct = "' . $wgGoogleAnalyticsAccount . '";</script>'); |
| 32 | + } |
| 33 | +} |
| 34 | + |
25 | 35 | function efGoogleAnalyticsHookText(&$skin, &$text='') { |
26 | 36 | $text .= efAddGoogleAnalytics(); |
27 | 37 | return true; |