1. 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

Discussion in 'XenForo Questions and Support' started by giorgino, Apr 17, 2015.

  1. giorgino

    giorgino Well-Known Member

    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?
     
  2. Chris D

    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".
     
    giorgino likes this.
  3. giorgino

    giorgino Well-Known Member

    Thank you Chris :)
     

Share This Page