javascriptgoogle-analyticssocialengineab-testinggoogle-experiments

Error: "ReferenceError: __gaTracker is not defined" for event of Google Analytic


I am working with A/B testing of Google Analytic. I have to check conversion on two different landing pages of my site. To achieve this I have created new Goal in Google Analytic. In this goal set Event to detect click to Signup Button

Below code I have set onclick of Signup button to send event trigger.

<a onclick="__gaTracker('send', 'event', 'Signup Click', 'Click', 'User Registration');" target="_blank" href="/signup">User Signup</a>

But when I click to this button, I am getting error of "ReferenceError: __gaTracker is not defined".

I tried to call it by using "ga" function but it also returning the same error.

Does anyone know how to make it working.


Solution

  • Paste the Google analytics script at footer or header of your page. This problem will be solved.