I had this tracking code on some of my links for some time, but now don't see any results. So I'm wondering if the Google Analytics syntax changed at some point?
<a alt="reviews" href="http://example.com/services/site-reviews/" onClick="ga('send', 'event', { eventCategory: 'Home', eventAction: 'site review'});">Site Reviews</a>
Or perhaps there is something wrong with the code that I'm not seeing? Secondary eyes would be very helpful here.
Thanks
Related
I'm in the middle of researching this and can't find a ton on the exact subject, so I was hoping one of you fine people might have the answer. Essentially, I'm trying to set up Content Groupings in Google Analytics for a network of WordPress installations where each blog post can have n number of tags and categories.
The Content Grouping would be something like Home Page, Posts, Pages.
Under the "Posts" Content Grouping, let's say I have a Movie post type that can track different genres (Romance and Comedy, or Science Fiction and Horror, or Action, Science Fiction and Horror, or even just Romance at times). I'd want to inject those into the page (easy enough to do), then loop through them and set them under the Posts content grouping for that particular page load.
However, the client is using Tealium for Google Analytics tracking, which adds a layer of abstraction to things. So the question is really a two-parter:
How would I fire off multiple tags for a given Content Grouping on a given page load so they're useful within Google Analytics?
How would I use Tealium to do that?
Tealium does offer up some documentation on Converting GUA Tracking to Tealium Tracking, like so:
Example GUA code snippet for event tracking
ga('send', {
hitType : 'event',
eventCategory : 'Videos',
eventAction : 'play',
eventLabel : 'Fall Campaign'
});
Converting to Tealium style by setting the ga_events variable with the GUA event fields:
utag.link({
ga_events: [{
eventCategory : 'Videos',
eventAction : 'play',
eventLabel : 'Fall Campaign'
}]
});
This is exactly the kind of Conversion Documentation I am looking for. However, it does not cover my use-case, which seems to require multiple calls to something like:
ga('set', 'Posts', 'Action');
ga('set', 'Posts', 'Science Fiction');
ga('set', 'Posts', 'Horror');
How would I do this (successfully) using Tealium?
Thanks in advance for any feedback or help anyone is willing to offer!
Edit
https://megalytic.com/blog/adding-google-analytics-content-group-tracking-to-a-wordpress-theme-using-google-tag-manager
This link talks about what I'm attempting to do, but using Google Tag Manager as opposed to Tealium. There is a lot of overlap there, so I'll try to dive in and find the equivalent process, but I'd still appreciate any help someone can provide!
It sounds like you'd be best off just writing your own custom javascript to manually fire your google analytics events. Could you use a custom container as described here? You can remove the script src if you don't need to load anything. You should then be able to have that container run on every page load.
Tealium works by mapping the variables in each tag.
First of all you need mapping the content grouping in your Google Analytics tag.
Then you can add the variable into the utag.link:
utag.link({
ga_events: [{
eventCategory : 'Videos',
eventAction : 'play',
eventLabel : 'Fall Campaign'
}],
Post : 'Action'
});
I'm using GTM in my company's online shop, and I installed some other tag via GTM's custom HTML tag, like this:
<script>
//some JS code...
var customParam=[{"key":"value"}];
var jsElm=document.createElement("script");
jsElm.type="text/javascript";
jsElm.async=true;
jsElm.src="https://some_tags.com/tag.js?s=CV";
document.body.appendChild(jsElm);
if(today < some date)
{
SEND GA EVENT here.....
}
</script>
The traditional GA event script
ga('send', 'event', 'XXX', 'pageview', 'some description', 1);
isn't working anymore here.
How do I did this ?
And I heard someone said that I should put data into DataLayer and do some bla bla bla... but I was understanding that too few to try. Is that a right way ?
I am going to answer with another question. Why are you sending events through HTML tags instead of Google Analytics Tag that are build just for that purpose?
I ll work with the assumption that you are new with this tool but the idea is that GTM replaces all old GA code on site.
Just create a new Tag and select 'Universal Analytics' and after that you can choose which kind of information you want on Google Analytics.
Its pretty self explanatory as a tool so i strongly recommend you to forget about those old GA codes and work with what you got.
In addition to this have in mind that you can use custom javascript variables to scrap DOM values in case you need to.
Here is our guru Simo Ahava: https://www.simoahava.com/
If you need anything else just ask.
I have a Wordpress site using the Google Analytics plugin by Yoast. At the bottom of my website I have a few buttons/images going to sellers of our product. I gave all those links unique Onclicks but they are just not working.
I've tried GA and gaq_push, Onmousedown and onclick but not seems to work. Anyone knows why?
So the right code for Yoast is:
onclick="__gaTracker('send', 'event', { eventCategory: 'your category', eventAction: 'your action', eventLabel: 'your label'});"
Notice the _gaTracker that is different from the standard GA trackingcode.
In the below code I want to added word say video name "XYZ" that should concatenate with Play.
I have code in which events are getting tracked if I don't concatenate video name.
ga('send', 'event', 'Play', 'pause', 'completed');
Can anybody suggest how can I concatenate the video name with Play in ga(..) code.
It's just Javscript, so you can put:
var videoName = 'Cookie Monster';
ga('send', 'event', 'Play-' + videoName, 'pause', 'completed');
If you use the Google Analytics Debugger (Chrome Extension), it'll confirm the code runs when it says: Running command: ga("send", "event", "Play-Cookie Monster", "pause", "completed")
Sameer, to get the name of the video, using the YouTube API, you can implement the answer in this question: Youtube API and tracking embedded video
Hope I've helped you.
Regards,
Vítor Capretz
I have been trying to set up event tracking for our company website and have hit a bit of a stumbling block.
I am tracking clicks to our telephone number. It appears that each website visit is being counted as call and appears under the tracking tab.
All I would like to measure is how many times people are 'clicking' to call us.
Am I overseeing something?
ga('create', 'UA-48180919-1', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['www........com/'] );
ga('send', 'pageview');
ga('send', 'event', 'calls', 'click', 'tel:00000000000', 9);
<a href="tel:0000 000 0000" onClick=”ga(‘send’, ‘event’, ‘calls’, ‘click’, ‘tel:00000000000’, 9);”>0000 000 0000</a>
I'm currently looking on Real Time/Events
Any help is appreciated.
Apparently, this is something that is not possible through Google Analytics alone. Instead, you have to use Google Adwords.