"Invalid tracking Id. Aborting hit." for Event Tracking - google-analytics

I have 2 ecommerce sites hosted on Shopify and Google Analytics properly implemented on both sites. I check my analytics daily, all that's good. Recently, I've been trying to do event tracking every time someone adds a product to their shopping cart.
Pretty much following this tutorial.
So I added the following to my add to cart buttons: onclick="_gaq.push(['_trackEvent', 'Products', 'Add To Cart', 'some-product-title']);" . This is working perfectly on my first ecommerce site, I see the event being tracked in Google Analytics.
On my second site however, it's not going through and I'm getting an error... using the GA Debugger, I tried doing that event tracking command in the console: _gaq.push(['_trackEvent', 'Products', 'Add To Cart', 'some-product-title'])
I get the following error: Invalid tracking Id. Aborting hit.
What does this mean? Trying to figure out how GA is being implemented differently on both sites, but can't figure it out. Thanks

Perhaps your new site is using Universal Analytics (analytics.js)? If that is the case, you'll have to update your event syntax to:
ga('send', 'event', 'Products', 'Add To Cart', 'some-product-title');

Related

Google Analytics Search Metrics

I need to implement google analytics search metrics. I have a ecommerce site. My requirement is that when i search for categories a list of products appears. Every product has like/ unlike button.
I need to track number of likes per search in google analytics.
Is this doable by google analytics ?
Please suggest!
You should use event tracking.
Events are user interactions with content that can be tracked
independently from a web page or a screen load. Downloads, mobile ad
clicks, gadgets, Flash elements, AJAX embedded elements, and video
plays are all examples of actions you might want to track as Events.
To fulfil your requirement, you could implement the event tracking as follows:
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
// you may add this implementation, says when someone like a product:
ga('send', 'event', 'Products', 'like', 'Search Page');
// or when someone unlike a product
ga('send', 'event', 'Products', 'dislike', 'Search Page');
If you have unique URL and PageView Tracking for each search, you have done and can view the metrics on Events > Top Events, with second dimension Page, filtered by search page.
Otherwise, you should setup Site Search. Send the pageview tracking manually as follows:
analytics.js: ga('send', 'pageview', '/search_results.php?q=keyword');

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'
});

Classic Analytics to Universal Analytics event tracking code

I'm going to switch from the Classic Analytics to Universal Analytics.
As I understand, I need to edit my event tracking code accordingly?
My current event tracking code look like this:
_gaq.push(['_trackEvent', 'Contact', 'About us', 'Contact form']);
What do I need to write in order to make it work with Universal Analytics?
The Universal Analytics syntax for tracking Custom Events would be:
ga('send', 'event', 'Contact', 'About us', 'Contact form');
You can check the official documentation about Custom Events here: https://developers.google.com/analytics/devguides/collection/analyticsjs/events
You might also be interested in the official guide to upgrading from the Classic to Universal Analytics: https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs

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.

Identify existing clients by event

I'm interested in working out how many visitors are going to my site who aren't already clients.
Currently the only way to identify whether someone visiting the site is an existing client is if they log in, which takes them to another area which doesn't have google analytics enabled.
I'm tracking the event already when they login with the following code
_gaq.push(['_trackEvent', 'Membership', 'Login', $('#UserName').val()]);
Can I find out the number of visitors who browse the site without triggering this event?
I think I've worked it out.
In google analytics you can add a custom advanced segment, in the above case its 'Event Category' = 'Membership' and 'Event Action' = 'Login'.
From there you can tick 'All Visits' and the custom segment to get a comparison.

Resources