Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-09 19:42:17

apsk121
Member
From: Punjab, India
Registered: 2004-09-02
Posts: 36
Website

Google Analytics inclusion

I’ve been using Slimstat and the wet_slimpattern for stats and it’s doing a very good job, but I was thinking of trying out Google Analytics also.
is there a way I can add the code to all pages by default like the wet_slimpattern plugin does for slimstat?

I tried a few things on the wet_slimpattern plugin code, but it just returned errors.
Here’s the code:
http://pastebin.com/f7ee5003e

Any ideas?

Offline

#2 2007-08-09 20:53:12

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Google Analytics inclusion

Google provides you with a code snippet which you can simply paste into your page template(s) before the closing </body> tag.

Offline

#3 2007-08-09 20:55:34

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: Google Analytics inclusion

you can put your footer in a form if not already and then put the google code in it. then include the footer (ie <txp:output_form form=“footer”>) in your page(s).

Last edited by iblastoff (2007-08-09 20:57:41)

Offline

#4 2007-08-10 13:20:48

apsk121
Member
From: Punjab, India
Registered: 2004-09-02
Posts: 36
Website

Re: Google Analytics inclusion

That all I can do, but it’s tough work editing all the page templates.
The wet_slimpattern plugin does this automatically for all pages, so i was looking for a way to do it like that. Automatically, without you having to individually include the code/footer/etc. on all pages.

Offline

#5 2007-08-10 20:32:00

qrayg
Member
From: USA
Registered: 2004-08-27
Posts: 81
Website

Re: Google Analytics inclusion

It’s good practice to do what iblastoff said.

I always build my sites with a common head and foot form and then use the output_form tag. I also have all of my sections use the default page so I can easily make site wide changes without any issues. if_section and if_category are your friends.

Sadly there probably isn’t a way to add the analytics code to the bottom of all of your pages easily. If I were you I’d rethink your site building habits.

Last edited by qrayg (2007-08-10 20:32:51)

Offline

#6 2007-08-12 17:11:04

Murk
Member
Registered: 2006-07-22
Posts: 12

Re: Google Analytics inclusion

I have a legacy site started in 1994 that’s still going strong. But when I added Google Analytics (GA) a few years ago, many of the old html pages weren’t included in the GA stats because there were no templates for those pages — updating for each page could only be done by hand and there were too many pages to fix for one person (me!). But those old pages are well-indexed and still get a lot of views.

I started using Shaun Inman’s MINT stats javascript on the site this year, and noticed that it was about 20% higher in pageviews than GA. The difference was the old pages. MINT has a PHP function that inserts the MINT javascript into every page automatically (I assume this happens when the pages are requested). I asked on the MINT forums about this and Shaun told me I could insert the GA code into the same function and it would work.

Since adding the GA code to MINT’s PHP script, the MINT and GA stats are nearly identical. Maybe something like this could work for your TXP site? I can’t post the PHP script since it’s part of the code I bought when I licensed MINT but you might want to visit the haveamint.com site and visit their forums. Search there on Google Analytics.

Offline

Board footer

Powered by FluxBB