Moodle 2: Google Analytics Integration

Moodle 2: Google Analytics Integration

by Jed Trow -
Number of replies: 9

Hi,

I am using Moodle 2.0.2 and the theme splash and am looking to integrate Google Analytics to give statistics for every public page so that I get stats for the individual pages not just for the entire site. I have read forums about 1.9 integration that suggest putting the code in the footer, but cant seem to get it to work in 2.0.2

I have added the code to the footnote editor in splash settings and the general.php file but neither worked. Does anyone know how to integrate it so that I will get stats for every guest accessable course and page without having to add it to each page manually

Thanks

Average of ratings: -
In reply to Jed Trow

Re: Moodle 2: Google Analytics Integration

by Guillermo Madero -

Why didn't it work? I mean, how do you know it didn't work?

After you add the code, do you see it if you look at the source code of the page?

In reply to Jed Trow

Re: Moodle 2: Google Analytics Integration

by Alex 3D -

Hi. I've encountered the same problem. But solved it in 2.0 this way: go to /theme/xxx/layout/ folder, where xxx- your theme's name. There you'll find general.php and BEFORE "</head>" tag you should add script that was provided by GAnalytics. But that layout file is used for all pages EXCEPT frontpage! So you should do the same thing with the frontpage.php file! Thats all - it worked fine to me ;)

In reply to Jed Trow

Re: Moodle 2: Google Analytics Integration

by Frances Vevers -

I don't know if this has been solved or not but for the benefit of others with the same problem:

In 2.0 go to Site Administration > Appearance > Additional HTML and copy the Tracking Code from Google Analytics into the 'Within Header' box.

I just found this solution in another forum post because I had the same problem, I think Within Header is the correct box, if I'm wrong please someone else correct me.

Average of ratings: Useful (2)
In reply to Frances Vevers

Re: Moodle 2: Google Analytics Integration

by Eric Turner -

Frances, thank you so much for leaving that very helpful info. I can confirm that I've successfully installed G Analytics in 2.0 by following your steps.  Thank you!

In reply to Frances Vevers

Re: Moodle 2: Google Analytics Integration

by Donald Graham -

Frances,

Your quick and easy instructions above are exactly the way to handle this issue in Moodle 2.0. It was right there the whole time. I have been looking everywhere to get this information. At least two books and all the instructions on the Moodle site are wrong. There are no header and footer .html files in 2.0. At least not that I could find. 

Thank you! Thank you! Thank you!

Don 

In reply to Frances Vevers

Re: Moodle 2: Google Analytics Integration

by Francis Feytout -

Hi Frances,

As a html page charges from the top down it is better to add this script right before the closing of body. That way the page is already loaded and available to read if/when lag hit.

Cheers smile

In reply to Francis Feytout

Re: Moodle 2: Google Analytics Integration

by nicole davis -
Thanks for the instruction!smile Google's services is indeed very helpful to us.However,With the increasing traffic of web users the government have requested a transparency report from Google.I have read that biannually, Google produces their Transparency Report. This report details the inquiries governments make of the company. Google says this report provides two functions. First, to be as transparent as possible about the requests those are and are not fulfilled for and by the government. Second, it is a way to prove that the rules that govern electronic privacy have to be reformed.Article resource: Government requests for user data on the rise, says Google
In reply to Francis Feytout

Re: Moodle 2: Google Analytics Integration

by Yvonne Hamilton -

Adding the script into 'Before BODY is closed' didn't work for us. Analytics stopped reporting so we have swapped back to Site Administration > Appearance > Additional HTML and copied the Tracking Code from Google Analytics into the 'Within Head' section.

In reply to Yvonne Hamilton

Re: Moodle 2: Google Analytics Integration

by David Sensenig -

Thanks! This was helpful for me. I had added the script to the footer and GA acknowledged that the site had it installed, but I wasn't seeing any traffic in the real time reporting section, which seemed odd since I was on the site at the time. I put it in the 'Within Head' section of Additional HTML and it worked immediately.