CodeIgniter Forums
Google Analytics - help! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Google Analytics - help! (/showthread.php?tid=58155)



Google Analytics - help! - El Forum - 05-21-2013

[eluser]Unknown[/eluser]
Hi all.

This is my first post on the forum, and I'm hoping to receive quick helping hand from someone about implementing Google Analytics tracking in a CodeIgniter website.

Basically, we had our website developed in CodeIgniter and our developers had forgotten to implement the Google Analytics tracking. Being relatively comfortable with editing a few lines of PHP, I figured this can't be too difficult. However, finding a plethora of topics on implementing hooks and redirects and access rights has made me too scared to touch anything.

Would someone please help illustrate to me where I should paste the Google Analytics tracking script (e.g. in the header.php file, which is called for every page, or in a separate PHP file as Google suggests - but where do I link it?)

Any advice would be greatly apprecaited. Thanks everyone Smile


Google Analytics - help! - El Forum - 05-21-2013

[eluser]bhogsett[/eluser]
I am no expert and have been using Codeigniter only for a couple of weeks.

I suggest you look in the application/views directory and within it in the templates directory. If there is a common header file it is likely there.

If there is no common header file, then look in application/views and whatever subdirectories have been created for your project. In one of those there should be a file with a name indicating it is a header file.

Once you find the right file (it will have the <head></head> contents, just drop the Google Analytics in.

Oh, I have not done this on my project yet, so good luck.

This is not something that requires mucking around with Codeigniter helpers, etc.

Hope this helps.

Bill


Google Analytics - help! - El Forum - 05-21-2013

[eluser]Unknown[/eluser]
Thanks Bill. I really appreciate your help. I've found the header.php file, so will give this a try.