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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

Google Analytics


Go to End


3 Posts   4521 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,
http://www.silverstripe.org/modules/

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

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.