Search code examples
wordpressgoogle-analyticsevent-tracking

Tracking phone number in Google analytics not working


So i'm new to event tracking, and i have followed the guide s online for phone and mail tracking (at least i think i do) but it seems like i don't get any data in GA. I used this guide: https://www.northstudio.com/blog/how-set-event-tracking-google-analytics

I'm using WP and DIVI theme tracking phone numbers and emails on this site: http://byg-ide.dk

In GA event tracking, this is what i have inserted:

Mail tracking:

Category: mail

Event: klik

label: send mail

Phone tracking

Category: telefonnr

Event: klik

label: opringning

Can anyone tell me why this is not tracking properly?


Solution

  • A couple issues I noticed:

    1. You are mixing _gaq and ga calls. The former is for classic GA, and the latter is for UA. I don't see the ga.js library on your site, so I assume you use UA, in which case your _gaq calls should be translated into ga calls, like this:

      _gaq.push(['_trackEvent','telefonnr','klik','opringning']);
      

      becomes

      ga('send', 'event', 'telefonnr', 'klik', 'opringning');
      
    2. Second thing is that your code is using smart quotes rather than straight quotes (if I only got a dollar for every time I saw this mistake):

      ga(‘send’, ‘event’, ‘telefonnr’, ‘klik’, ‘opringning’);
      

      should have straight quotes

      ga('send', 'event', 'telefonnr', 'klik', 'opringning');