Google Analytics and CMS/PHP type auto-generated pages
September 1, 2008 4:30 AM   Subscribe

Question about Google Analytics and CMS/PHP type auto-generated pages.

So, I have set up an e-learning site, using Moodle software. This is my first foray into anything other than hand-coded HTML static pages.

Here is my question:
the parent site ( has the javascript code embedded on each page to give me access to the google analytics tools. The Moodle installation is a sub-branch on the same website (/learning). I would like to be able to get analytics stats for that section too, but am well over my head as to how I can do that.

Can anyone with some MySQL / php background give me some advice?
posted by Meatbomb to Computers & Internet (4 answers total)
Best answer: Even the pages that are generated from a MySQL database through php commands are build up from templates. [Often named ****.php].

If there's one template, you add the Google Analytics javascript to that, as close to the bottom as possible.

If there are several templates, either design a common footer for all of them, with the Google Analytics script, or add that code to all.
posted by ijsbrand at 4:55 AM on September 1, 2008

Response by poster: Dear ijsbrand: so if you look at my site, you will see I have added the CC license info on every page, by modifying "footer.html"... this footer seems to be attached to every page created - so is that cool to just paste the google analytics javascript there as well?
posted by Meatbomb at 5:14 AM on September 1, 2008

As ijsbrand says there will be include files. Can you do a seartch on the files? Look for the <> tag. Hopefuilly it will be in an included file that applies to all pages.

If it's php you'll want to add the analytics code by doing:

echo "analytics code here. Don't forget to \"escape\" double quotes in the text with a forward slash"
posted by twistedonion at 5:19 AM on September 1, 2008

Best answer: Darnm, that should have been, look for the close body tag.

I see you got it sorted anyway by looking at your source.
posted by twistedonion at 5:29 AM on September 1, 2008

« Older Getting milk out of computer keyboard   |   A great problem to have Newer »
This thread is closed to new comments.