• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Trouble with Google Analytics and XenForo

giorgino

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

Code:
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
#2
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".