Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Google Analytics


Reply


3 Posts   1940 Views

Avatar
StevenL

Community Member, 3 Posts

20 May 2011 at 4:33am

Hello,

I've just signed up for Google Analytics to proivide me with data about the company website. I have the script I need to put on each page I want to track, but when I click "view HTML" in the CMS and paste the script, it doesn't seem to add it to the page. Also, this is not a *full* HTML, as all it displays is "<p> content </p>, and I can't see any headers or other information I might want to manipulate.

How can I add this Google Analytics script to my site?

Avatar
moloko_man

Community Member, 72 Posts

20 May 2011 at 8:51am

Edited: 20/05/2011 8:52am

I guess I should ask, are you only trying to track one page or every page?

With silverstripe you can't just add google's code to a page through the CMS. The headers that you will need to work in are in the php files (i.e. page.php) and/or the ss files.

There is one or two google analytics modules out there,
[url]http://www.silverstripe.org/modules/[/url]

or there is a tutorial on how to put it in yourself here: [url]http://www.ssbits.com/tutorials/2010/quick-and-easy-google-analytics-with-siteconfig/[/url].

I used the SSBits tutorial so I could do some custom stuff, it also helped me learn more about how modules work and are built.

Avatar
StevenL

Community Member, 3 Posts

20 May 2011 at 8:57am

Ideally I'd track every page, but it's not necessary to track them all. At any rate, I'll be tracking multiple pages. Thanks for the links, I'll check those out and see what I can do.