How to add Google Analytics to the default Gallery 2 Theme

I'm sure a lot of people want to add the new Google Analytics website tracker to their Gallery 2 installs. It's a pretty straight forward edition to make, but I'll outline it here. 1. Copy /gallery2/themes/matrix/templates/theme.tpl into a new directory under templates/ called local. The new copy should now reside in /gallery2/themes/matrix/templates/local/theme.tpl This makes Gallery 2 use the copy in templates/local/ instead of the default one in templates/ and doing this ensures that any changes you have made will survive an update (either via a new Gallery 2 release or a cvs update). 2. Find the following:

 {* Include this theme's style sheet *}
 


3. Insert the Google Analytics javascript somewhere between and like this:

{* Include this theme's style sheet *}
 
 
 
 

4. Remember to change the _uacct = "UA-xxxxx-x"; to your actual Analytics tracker ID. 5. Watch Google Analyzer give you statistics nirvana

Posted by Christian Mohn aka h0bbel

Post metadata


Published November 14, 2005 14:36
9 comments

Tagged with , , , , , and 


9 Responses to How to add Google Analytics to the default Gallery 2 Theme:

  • nicheplayer
    2005-11-15 00:54:23

    Great tip. Thanks!

    So, Gallery2 is one of the sites at my domain. When I go to my Google Analytics home page to add tracking for Gallery2, it asks if I want to create a new domain or create a profile for an existing domain. I went ahead and created a profile for an existing domain (nicheplayer.net) and called it Gallery2. I have the Analytics tracking script added to my (PGtheme) theme.tpl in /local, and Google Analytics says it’s waiting to gather information on that address, but I wonder if I’ve done this the correct way?

  • h0bbel
    2005-11-15 00:59:17

    Looks like it, i’ve been signed up for a while but it’s still gathering data from me. Looks like Google has some problems with migrating data at the moment ( http://blog.outer-court.com/archive/2005-11-14-n64.html ). As long as you put the Google javascript inside the header tags for your theme, you should be fine.

  • Florin Andrei
    2006-01-19 22:13:13

    How about multisite G2 installs?
    Editing the master G2 directory won’t work, since each G2 site has its own Analytics ID.
    Any idea?

  • h0bbel
    2006-01-19 22:18:14

    Clone the themes and use one for each multihost :-)

  • Making a Gallery Google Analytics-enabled | Gallery
    2007-03-29 02:06:52

    […] also posted http://h0bbel.p0ggel.org/item/how-to-add-google-analytics-to-the-default-gallery-2-theme/ and I’lladd a link from the codex to this thread as […]

  • Joomla - SWiK
    2007-06-05 18:49:20

    […] How to add Google Analytics to the default Gallery 2 Theme - h0bbel […]

  • Marco
    2007-07-04 12:00:20

    Thanks a lot!!

  • Quintin
    2007-07-06 08:57:21

    Hey, thanks for this tip.

    Your website looks like light green on dark green colors. Super hard to read, at least on my 19” crt and 14” lcd ..

  • h0bbel
    2007-07-06 11:15:36

    I know it’s a bit hard to read, at least for some people. I’m working on a new theme and a new system to power this site, so stay tuned.

2 Pingbacks to How to add Google Analytics to the default Gallery 2 Theme:

Leave a Reply


Contact me

Lets talk!
Get in touch