Trouble with Google Analytics and XenForo


Well-known member
Today I've set up a tracking event
Something like
<a href="" onClick="ga('send', 'event', 'sponsored link', 'Click', 'campaign', 1)" target="_blank">Click Here!</a>
but I found an error in JS console like this:

Uncaught ReferenceError: ga is not defined
Googling I've found this should be an error related to XenForo default Google Analytics snippet.

How can I solve this?

Chris D

XenForo developer
Staff member
This isn't really a bug.

The Google Analytics code built into XenForo is functional, but I believe the code you're using is a new variant; Universal Analytics.

If you want to do anything aside from the basic tracking, you would need to add your own tracking code or update the existing code.

There may be threads on this subject already if you search for "Universal Analytics".