Tracking phone number in Google analytics not working - wordpress

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?

A couple issues I noticed:
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');
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');

Related

Knowing when Google Analytics has loaded when loaded via Google Tag Manager

We're using GTM to load Universal Analytics and I want to send some custom events from js to GA.
So I need to do something like this:
ga('send', {
hitType: 'event',
eventCategory: 'Legitimation',
eventAction: 'Is returning customer',
nonInteraction: true
});
But I don't know when GA has loaded since GTM makes everything async.
How can I know when ga() is ready?
Sending GA Events not through the Tag Manager if you load GA through the GTM is a little bit tricky. You can´t use the normal events you use if you have GA hardcoded on the Page.
Here is a good thread about this - also answering your question: https://productforums.google.com/forum/#!topic/tag-manager/C2j4nt8dBxw
I would suggest to send Datalayers instead of Events, catch this Datalayers with the GTM and send the Events through the GTM. This makes it a lot easier.

Google Analytics - send data to google analytics

I have recently been given a project requirement to send data over to google analytics from a certain page. I have no clue how to do that.
Account Id and every thing has already been created, I just want to know how I could send data on load of a certain webpage.
I have been looking up google analytics from what I understood I think I need to first push into ga functions the analytics tacking id and I think I need to have pageview as the event.
Could someone please share tutorial links for this?
Regards,
Farhan
I hope you are looking for the Event Tracking with the Google Analytics as page Tracking is Quite Simple you just need to add the tracking code and page Tracking is done so check out the below link and code you will find how you can do the Event Tracking
Send custom Event to Google Analytics
ga('send', {
hitType: 'event',
eventCategory: 'Videos',
eventAction: 'play',
eventLabel: 'Fall Campaign'
});

GTM eCommerce tracking

I would like to start tracking e-commerce with Google Analytics, to do this I need to pass the values of my data layer into GA using GTM. I have read endless amounts of documentation on the subject and as far as I can tell it should work, however I am still having problems.
The online store we use is actually a third party system (quote engine) so we can't change what is passed to the dataLayer, everything we need is passed to the dataLayer but I can't figure out how to send this data using GTM to GA.
My data layer looks something like this on the checkout page of the site:
dataLayer = [{
'u12': '18000011', 'u10': '31903296', 'u11': '159328761', 'u3': 'XXLX', 'u7': '58.97'
}];
The custom HTML tag in GTM I'm using is firing in the correct place but not sending the information to GA, the tag looks like this:
<script>
ga('require', 'ecommerce', 'ecommerce.js');
ga('ecommerce:addTransaction', {
id: '{{u12}}',
revenue: '{{u7}}'
});
ga('ecommerce:addItem', {
sku: '{{u12}}',
name: '{{u3}}',
price: '{{u7}}',
quantity: '1'
});
ga('ecommerce:send');
Unfortunately this is not working and my Google Analytics is empty in terms of e-commerce transactions, any help on this would be greatly appreciated.
Google pushes the enhanced ecommerce tracking thing. It is hard to find the old documentation of the standard ecommerce tracking.
GA Ecommerce Tracking with Google Tag manager
The solution was a combination of the two answers. I used Mindbreakers link as a template to create the custom data layer suggested by Eike Pierstorff and then used a standard transaction tag in GTM to send the information.
I would like to say a huge thanks to Eike Pierstorff and Mindbreaker for helping me with this.

Can I pass google analytics marketing tracking code to a following page (when the landing page doesn't have GA code)

I am in a scenario where we are tagging up on part of the site (purchase.mysite.com) with GA tags but we aren't tagging up the main site (www.mysite.com).
The problem is that a lot of traffic that goes to purchase.mysite.com initially goes via www.mysite.com which means if a user lands on www.mysite.com with a marketing tracking code and then goes to purchase.mysite.com the tracking code will be lost and all traffic from this route will be considered referral.
Is there a way to still pass this marketing campaign code when the user hits purchase.mysite.com (other than adding GA code to the main site which we don't want to do)?
If not possible in GA, is there another technical solution like saving the tracking code in the cookie and then setting it when the user goes to purchase.mysite.com?
Any help would be greatly appreciated.
Thanks,
Frank
Frank,
Your final paragraph htis the nail on the head: save your campaign tracking data into your own cookie and then read this cookie when you're on a page with GA on it and manually set the campaign data. You only need to set it once and it will then propogate through for the whole session/user as per your requirements.
To set the campaign data manually, just use code such as this (ref: https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#campaignName)
ga('set', 'campaignName', 'My Campaign Name');
ga('set', 'campaignSource', 'anotherwebsite.com');
ga('set', 'campaignMedium', 'cpc');
ga('send', 'pageview');
notes
You must set at least Source & Medium for the data to register with GA
Medium has a fixed set of possible values as per this google doc: https://support.google.com/analytics/answer/1033173?hl=en

Google Analytics - Inpage Analytics - Outbound Link Click Count

I'd like to see how many clicks occur to the "Buy Now" links on my website. Unfortunately, the buy now links are external to my site. There has got to be a way to set up these links so I can see the click count when I view the inpage analytics.
How do you set up Google Analytics so it will track the outbound links and show the click count in the inpage analytics?
You want to use event tracking for this. Here is a simple one using Universal Analytics (with jQuery):
jQuery('a.tracklink').on('click', function() {
ga('send', 'event', 'Category', 'Action', 'Label');
});
You'll want to change the Category, Action, and Label to properly categorize them in GA. Maybe something like:
ga('send', 'event', 'Outbound Link', 'Click', 'Buy Now');
Others may recommend stopping the propagation of the click action to make sure the tracking goes through (and then forwarding on success), but there are some UX reasons why I'm not a fan of that method. I have not personally run into an issue of the event not being tracked with the above method.

Resources