Extension talk:Google Analytics Integration/Archive

NOTE - Please install new version
Please install the latest version! As seen below - The initial release of the extension was not returning 'true' properly, which causes errors in MW 1.11+ and halts further processing on the specified Hook in every version! (not cool)

I installed this extension on my MW 1.11(Alpha). Got Following error.
(Note I have removed my hosting a/c name and put XXXXX instead for obvious reason.)

MediaWiki internal error. Original exception: exception 'MWException' with message 'Detected bug in an extension! Hook googleAnalyticsHook failed to return a value; should return true to continue hook processing or false to abort.' in /home/XXXXX/public_html/wiki/includes/Hooks.php:133 Stack trace: Exception caught inside exception handler: exception 'MWException' with message 'Detected bug in an extension! Hook googleAnalyticsHook failed to return a value; should return true to continue hook processing or false to abort.' in /home/XXXXX/public_html/wiki/includes/Hooks.php:133 Stack trace: MonoBookTemplate->execute('MonoBookTemplat...', Array)
 * 1) 0 /home/XXXXX/public_html/wiki/skins/MonoBook.php(225): wfRunHooks
 * 2) 1 /home/XXXXX/public_html/wiki/includes/SkinTemplate.php(463): MonoBookTemplate->execute('MonoBookTemplat...', Array)
 * 3) 2 /home/XXXXX/public_html/wiki/includes/OutputPage.php(683): SkinTemplate->outputPage
 * 4) 3 /home/XXXXX/public_html/wiki/includes/Wiki.php(301): OutputPage->output(Object(OutputPage))
 * 5) 4 /home/XXXXX/public_html/wiki/index.php(90): MediaWiki->finalCleanup
 * 6) 5 {main}
 * 1) 0 /home/XXXXX/public_html/wiki/skins/MonoBook.php(225): wfRunHooks
 * 2) 1 /home/XXXXX/public_html/wiki/includes/SkinTemplate.php(463):
 * 1) 2 /home/XXXXX/public_html/wiki/includes/OutputPage.php(683): SkinTemplate->outputPage
 * 2) 3 /home/XXXXX/public_html/wiki/includes/Exception.php(86): OutputPage->output(Object(OutputPage))
 * 3) 4 /home/XXXXX/public_html/wiki/includes/Exception.php(111): MWException->reportHTML
 * 4) 5 /home/XXXXX/public_html/wiki/includes/Exception.php(191): MWException->report
 * 5) 6 /home/XXXXX/public_html/wiki/includes/Exception.php(225): wfReportException
 * 6) 7 [internal function]: wfExceptionHandler
 * 7) 8 {main}

-Gautam
 * Thx! The posted code should be working now.

runonloadhook
Tim, thanks for making this great extension. If you look at the code of any page in MW, you'll see near the end: if (window.runOnloadHook) runOnloadHook; Wouldnt using this hook (if possible) be a better way because GA advises to use the code just before the body tag? This hook is about just before the body tag. --Kenny5 19:11, 2 September 2007 (UTC)


 * If you run this extension on 1.11alpha+, you'll notice that the GA code actually shows up BELOW that script line. I added a new hook to the core (SkinAfterBottomScripts) specifically designed for JS-powered analytics engines.  I talked to the guys over at Google regarding the tag placement and they said that as long as Google is receiving data, the tag placement is fine.  There are certain locations where the script will not be executed properly and that's why they say put it at the bottom.  Either way, if you get data in your GA reports, you're good - and once 1.11 comes out, the extension utilizes the new hook that puts the script tag at the absolute bottom of the page.
 * Ah I see, great then. I'll wait for the upgrades then. Thanks for all your research in this. And I just checked and am getting the data even with my 1.9.3 (should have mentioned before) so this is great. This extension is great, I didnt have to alter the internal files in any way (which is always the goal). thanks again --Kenny5 19:35, 2 September 2007 (UTC)