I'm a complete newbie to google analytics, new like I was put on a project yesterday and I've been combing through docs trying to figure out what's wrong with this _trackEvent that I'm trying to set up.
Here's the setup:
I have a drupal site that has had some custom events set up. One of the events that we track is outbound links, and that works great. What we want to do is start creating special cases for some of these links. So for example I have a live chat button w/ this code:
<a href='url/to/chat
onclick="_gaq.push(['_trackEvent','LiveChat','btnClick',this.href]);
setTimeout(function(){this.newWindow = window.open(this.href);
this.newWindow.focus();
this.newWindow.opener=window;},200);
return false;"><img alt='Live Chat Software' src='src/url' border='0'></a>
so what I did is ran the calls through the ga_debug.js. This is the output I got
_gaq.push processing "_trackEvent" for args:
"[Outbound links,Click,outgoing/url]": Track Event
Tracking beacon sent!
This means that an event is getting sent on click. So I'm curious why it's sending an Outbound Links event rather than my LiveChat event? Could it be scoping issues? Not sure, as I know the outbound links is defined at a global level. Anyone have any suggestions/insights/opinions? Before berating me about code, I have inherited this project and I'm just trying to understand it better.
thank you,
Brodie
Okay so it turns out that it was a scoping issue. When they had originally set us up the bomb the click event was registered to the body as opposed to being an inline. So that was eating the inline event.
lesson learned: double check scoping
tools that helped
ga_debug.js
Related
Looking more for some fresh ideas to help me troubleshoot the below problem than solving any coding issues (which may come next).
Creating a similar site to an existing one that uses all previous GA tech (analytics.js, _gaq.push, Google_Service_AnalyticsReporting_ReportRequest(), etc) and provides all the easy data needed for my simple GA reports (i.e. page views by date and location).
However, not quite ready to bite off the whole enchilada (GTAGMgr, GA4, and such) so created dual Properties (UA and GA) as many forums have recommended when making the transition.
Setup the website same as the active [UA] site but using the gtag.js (per the Property Tracking Code snippet provided in ADMIN) vs the analytics.js code. Created View(s), new Service Account for the "user", an API Map Key for the Google Map Charts, and any other pieces I could find.
Have the GTAG.JS setup on each page and added any special page tracking via gtag('event', 'page view', {...}) but letting the default page view still occur as well.
Page view hits are coming through as expected EXCEPT the page views locations (City, State, Country, Region) are not being populated. All that comes thru is the "not set" for any location. Ironically, the old analytics.js code was still active initially and location data was being populated.
Would think if gtag.js is collecting standard page view info for the configured Property, that location data would be there as well. Am sure it is but possibly the older getReport calls need tweaking. No doubt I probably have a something not quite right but if REALTIME data shows usage, page views, etc. AND my GA Report calls are working, would think location data would be there too.
Any brainstorming ideas would be appreciated.
Thank you,
LarryG
ANSWER ... the EZ Button ... my code and calls were correct using old and [semi] new way. The majority of the problems were McAfee VPN kicking in. It is set to turn on with reboot and I do not always remember to turn it off. The first obvious clue was the realtime location for my actions were not where they were supposed to be. Also, appears Google API PHP Client has some issues with PHP7.4FastCGI.
So if you took the time to read ... check your VPN settings if you are getting an abnormal amount of NOT SETS in your GA data.
Begs the question ... with the increase in companies providing VPN services out of the box, that renders some of the tracking a moot point.
LarryG
I am fairly new to GTM and trying to figure out something here.
This is the url where i have set up gtm:
http://pizza.de/order/testshop/5283/index.htm
If you see at console, dataLayer is correctly set. So there is no problem with dataLayer, however i don't see the collect.js url firing. I am very sure that the configuration is correct but not able to figure out why the dataLayer is not being pushed to the server.
Any help will with greatly appreciated.
Move your dataLayer.push code to come before the GTM container tag. You are pushing to the dataLayer afterwards, so the GTM container is not able to use it.
From this:https://developers.google.com/tag-manager/devguide?hl=en
Variables pushed to the data layer (i.e. using dataLayer.push()) after the container snippet will not be able to fire tags on page loads with a matching condition.
#nyuen, was for responding late. Was AFK. Unfortunately, that didn't help. I made a small application running on localhost and tried to create the same scenario.
Variables pushed to the data layer (i.e. using dataLayer.push()) after the container snippet will not be able to fire tags on page loads with a matching condition.
The above is correct, but however i realized that it still fires no matter where you place the dataLayer, but its better to follow the documentation.
What I realized is that, gtm.js is responsible to fire analytics.js and analytics.js is responsible to fire the events. In my case, due to some unknown reason, analytics.js was not loading at all. So I had to inject this script and then the events started firing.
I believe Google Tag Manager is fairly new and nothing much is going on yet. I went all around Google looking for a solution, but simply gave up after trying all possible solutions. I'm using a Wordpress blog platform, and have integrated Universal Analytics and Google Tag Manager. The settings for my listeners are as follows:
====Link Click Listener====
====Outbound Link Click Tagger====
====Outbound Link Rule====
I used console to test the dataLayer, and it retrieves gtm.load, gtm.js and gtm.dom, but regardless of whatever I click, I see on my Google Analytics that the events are undefined even though I provided the necessary parameter to name them. However, when I tried to do it on a different browser, it works, but not completely (instead of outbound link, it will record it under click), or the outbound works for a completely random client on the Internet, returning the tag "outbound-link" but with an undefined action.
Any ideas?
UPDATE I just noticed that there is a difference between a left-mouse-button click and a middle-mouse-button click. The middle one is not measured, whereas the left-mouse-button click is.
For starters there is an error in your rule. You want "{{element url}} does not contain welink.com" instead of just {{url}} (which would mean that the tag should not fire on your domain at all).
I've a problem with a function of Google Anlytics monitoring.
I want to track the download of a file on my web site and I wrote the following line:
<a href="/file_download/nomefile.zip" onclick="_gaq.push(['_trackEvent', 'download', 'click', 'myFile']);">
But it seemes it doesn't work correctly. There are some downloads not shown and it seems to work only in a specific region: only tracks click from Italy, for example.
Can you give me any help or suggestion in order to resolve the problem, please?
Ps. I'm sure there are not tracking downloads because some people contacted me for support on the file and no event of download is shown.
The problem with this implementation is that the page gets unloaded before the event is recorded. To solve you can do one of the following:
Use universal analytics. This implementation uses a function call which will get executed before unload.
Wrap the click in a function which will delay the unloading of the page by several hundred milliseconds.
I've been all over google and SO looking for answers here. I've checked code against google's tracking code suggestions and I've even tested with their sample code. But I cannot get the events to be properly tracked in Google Analytics. My code has been live on the site for some time (~ a month), so this should have overcome any lag on the reports there.
I'm using analytics, the async version, which works fine for page tracking and other 'normal' features. Trying to set up event tracking, I followed the example, and waited a week. Still nothing. I've been debugging and I'm not having any of the 'normal' problems (as far as I can see).
So:
Example tracking code fired:
Play
This triggers an event, which according to ga_debug.js, is fired successfully. Checking the network panel I can see the request and _umt.gif returns status 200.
I've checked the request string in there. All seems good.
But checking GA, there is nothing in the reports. But when you go to GA Realtime > Events, you can see the events being fired!?
I can trigger the events on page or fire them from the console and corresponding events show up in the realtime section, but they have no data (Category, Action or Label).
This is odd, that even firing Google's own example code nothing is showing up.
If anyone has any ideas of where to start debugging for this (or has experience of anything similar), it would be great to hear.
I have been struggling with this issue for three days. I know this thread is old, but I stumbled upon it during my searching. I wanted to post what my personal resolution was in case someone else comes across this.
My Solution:
Here is where I finally found it:
https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCustomVariables
Under: "Using Custom Variables" > "Traditional (ga.js) Snippet" (We are using the ga.js still... for now.)
I had a similar problem and ran into this issue:
https://issuetracker.google.com/issues/35353093
In summary, I was setting the userId property via below. Removing that started historical tracking for me.
ga('set', 'userId', username);
This question gets asked a lot and the answer is almost always "Google Analytics standard SLA is 24 hours". The logs are processed in batch behind the scenes. At peak times, this takes a while.
It can take up to 24 hours for the Google Analytics servers to update -- Source: Google Documentation - Check your web tracking code setup