0

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.

vaibhavmande
  • 1,115
  • 9
  • 17
Gokul Shinde
  • 957
  • 3
  • 10
  • 30
  • 1
    Paste the Google analytics library Js at footer or header of the page which you for from Google. – kannan Nov 14 '15 at 05:16
  • `__gaTracker` is a custom function defined by a [plugin : Google Analytics for WordPress by MonsterInsights](https://wordpress.org/plugins/google-analytics-for-wordpress/) in Wordpress. Instead using `ga` function, the plugin redefines the name of the function and each event fires the new function. – Rufein Apr 03 '18 at 09:43
  • More info in this [link](https://wordpress.org/support/topic/note-change-of-global-function-ga-_gatracker/) – Rufein Apr 03 '18 at 09:51

1 Answers1

3

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

kannan
  • 691
  • 5
  • 17
  • – Gokul Shinde Nov 14 '15 at 05:35
  • I have this Google analytic script in header and still I am getting error. – Gokul Shinde Nov 14 '15 at 05:36
  • 1
    Sign in Google using Google analytics account and get the analytics code from there, then replace it with old one on your page – kannan Nov 14 '15 at 07:11
  • 2
    Many thanks for your answer. It is working fine when I add analytics code directly into page. Just Need to replace function name "__gaTracker" to "ga". – Gokul Shinde Nov 14 '15 at 10:16