Google Analytics Example
From Facebook Developer Wiki
You can just stick <fb:google-analytics/> tags on each page, but it's clunky - especially if you want to differentiate between pages. It's a lot better to put it in a function in your lib.php and just call the function. I've reproduced an example from my app, Quote Book, here. Fill in, of course, your uacct number.
[edit] lib.php
//RenderHeader($pageid)
//Renders a standard header with Google Analytics
//As well as any ads you may employ
//$pageid is passed to Google Analytics for tracking separate pages
//$doheader is a global variable to switch on and off headers as necessary
function RenderHeader($pageid) {
global $doheader;
if($doheader) {
echo "<fb:google-analytics uacct='UA-XXXXXX-X' page='$pageid' />";
}
}
[edit] In-Page Code
include_once "lib.php";
RenderHeader("canvas");
