Forums | Mahara Community

Support /
Installation of google analytics in Mahara


Andreas Zitek's profile picture
Posts: 9

29 March 2019, 6:14

Hello!

I tried to install Google Analytics on our Mahara installation floowing this guide.  elearning.3rdwavemedia.com/blog/how-to-add-google-analytics-to-your-mahara-site/2622/

But this did not work. The webpage did not load again, when I added this script.

Can you help?

Thank you!

Andreas

Kristina Hoeppner's profile picture
Posts: 4863

29 March 2019, 11:19

Hi Andreas,

Could you please post your config file (not as image but as text) but obfuscate any identifying elements (in particular passwords and actual URLs!)? Without seeing what you put into the file, it's not possible to know if there is an additional character or anything else in the file that might have made its way in there accidentally.

Thanks

Kristina

Andreas Zitek's profile picture
Posts: 9

29 March 2019, 12:25

 

$cfg->additionalhtmlhead = "

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="link not allowed_www.googletagmanager.com/gtag/js?id=UA-136158086-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-136158086-2');
</script>";

 

Andreas Zitek's profile picture
Posts: 9

29 March 2019, 12:25

[WAR] 80 Undefined property: stdClass::$log_backtrace_print_args
Call stack (most recent first):
  • log_message(string(size 55), integer, true, true, string(size 37), integer) at /home/intrinsic/www/ce/lib/errors.php:520
  • error(integer, string(size 55), string(size 37), integer, array(size 5)) at /home/intrinsic/www/ce/lib/errors.php:314
  • log_build_backtrace(array(size 1)) at /home/intrinsic/www/ce/lib/errors.php:160
  • log_message(string(size 57), integer, true, true, string(size 37), integer, array(size 1)) at /home/intrinsic/www/ce/lib/errors.php:647
  • MaharaException->handle_exception() at /home/intrinsic/www/ce/lib/errors.php:546
  • exception(object(SystemException)) at Unknown:0
[WAR] 80 [ParseError]: syntax error, unexpected 'https' (T_STRING)
Call stack (most recent first):
  • exception(object(ParseError)) at Unknown:0

Mahara: Site Unavailable

A nonrecoverable error occurred. This probably means you have encountered a bug in the system
Kristina Hoeppner's profile picture
Posts: 4863

05 April 2019, 14:54

Hi Andreas,

The error message mentions "unexpected 'https'". Since you didn't post any protocol in the extract of the config you posted, I wouldn't know if it relates to that or if the error message is related to something else.

Please remove the Google Analytics config parameter from your config file and confirm that your site still works correctly, and then add it back in and see if you can find the unexpected https. It's not possible for us to troubleshoot beyond that because we can't see your entire config file and the crucial information, the https, is not included in what you posted.

Cheers

Kristina

Andreas Zitek's profile picture
Posts: 9

24 April 2019, 9:22

Dear Kristina! The unexpected https is from the Google analytics file: 

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-136158086-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-136158086-2');
</script>

 

Thank You!

Kristina Hoeppner's profile picture
Posts: 4863

26 April 2019, 15:06

Hi Andreas,

Below, please find the code that you would need. It works locally for me, i.e. I do not see any error message.

There were a couple of problems:

  • The protocol should not be there. Instead, it should be written //www...
  • There were quotation marks around the URL. Since quotation marks are part of the syntax for the additional head in your case, the quotation marks would need to be converted to single quotes.

Cheers

Kristina

----------------------

 

$cfg->additionalhtmlhead = "
<script async src='//www.googletagmanager.com/gtag/js?id=UA-136158086-2'></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-136158086-2');
</script>";

Andreas Zitek's profile picture
Posts: 9

08 May 2019, 1:33

Dear Kristina! Great! It worked! You are a genius! This was really helpful! We also managed to get the page template back - it wqs a problem in the database (we documented the problem in the forum with screenshots).

Thank you!

Best!

Andreas

Andreas Zitek's profile picture
Posts: 9

02 April 2019, 21:08

Dear Kristina! Do you have any information on a potential solution for my problem? Thank you! Best! andreas

9 results