Browser and devices data from Google analytics code - javascript

Is is possible to leverage Google analytics code to get browser and devices data. Want to add this data to anonymous feedback widget.
We already use classic GA tracking so thought it might be an option to reuse whatever method they use for recording browser, os, device etc that's available in GA reports.

Basically every browser is a code that is scraping data from a website. If it can, you can too.
https://developers.google.com/analytics/devguides/reporting/
Scraping Real Time Visitors from Google Analytics
I recommend you use Google Analytics APIs for this purpose.
These are a few links that can help you.

Related

De-bugging Google Analytics Link & Download Tracking

I'm trying to install some script on one of my websites to track outbound links and downloads in Google Analytics but I'm not having much luck. This is the script that I'm using (if anyone knows of a better guide or script I'd love to hear about it).
My question is this: How can I check whether it's working without using Google Analytics? Is there a way I can see the events or data that's being sent when a link or download is clicked using Firebug or Developer Tools?
Thanks in advance,
Tom
You might use the GA autotrack plugins instead (https://github.com/googleanalytics/autotrack) - while not an "offical" part of the product those are written by a Google engineer (who also maintains some presence at stackoverflow).
However it is easy to see if this works - Google offers the Google Tag Assistant (for Chrome) to test GA integrations, there is a Chrome GA Debugger Extension, or you might simply open the developer tools in your browser and inspect the "network" tab. If you filter for calls to google-analytics.com/collect you should see outgoing calls and can look at the query parameters to see if your data is sent properly; if the calls return a http status of 200 the data should turn up in your GA account.
Thanks to Eike's response I've now chosen to solve this challenge by installing Google Tag Manager and then creating custom tags to track things like outbound links, email links and download links. Here's a guide that helped me to setup download tracking, hope others find it useful.

Conflict with double google analytics

I have a website that only has a full window iframe to a page that already has google analytics, but not on my account(the page isn't mine either). I would like to track my website with Google Analytics and if I put the script in the head site it will say "Tracking not installed". IS there any way to make the browser ignore the google analytics from the iframe?
If the iframed GA account isn't yours then there is nothing you can do about it. However you can still implement your own analytics by simply doing what you were doing before and putting your own GA code on your pages. You will see that tracking not installed message because it normally takes at least 24 hours for the code to register. In the meantime if there is nothing else wrong with the implementation, you can check in your Real-time reports to see if your own simultaneous visits are recorded. If they are then you are good to go and just need to wait 24 hours for data to show up in your standard reports.
You cannot change the content of the iframe, it would violate the same origin policy. Are you sure you should be using an iframe at all? Either way you can easily add Google Analytics to your own site and track whatever you need with your own Google Analytics ID.
If your analytics code is in the iframe, Google will report that tracking isn't installed as they're checking the parent page, not the iframe. Tracking will still work, though. You should see stats come through normally.

Google Analytics for third-party embedded widget

I've been able to test this to a certain extent within our application, however I'm still testing the waters with google analytics to see if it is the best choice for app analytics; for externally embedded javascript.
I'm able to fire custom events, and custom page views. However I'd like to see all online users across all sites that have the widget embedded on. It currently shows online users, but it uses a relative URL path, instead of the domain or full path.
The type of data points I'm hoping to gather are specific interactions the user makes with the application, as well as live statistics which can be drilled down to the publisher of the embed.
Has anyone had experience using google analytics for third party embeds? or is there another service out there that is better suited for app analytics of this nature?

How to make a Google Maps API (.js) file a part of a widget for Mobiles

I would like to create a Web App for device. For that I would have some script being stored on device, instead of downloading them all time when I start application. As far as I saw including a GoogleMaps API makes some additional request for javascript files. Is there any way of having all of them taken directly from local store? Or is this always have to refeer to google web address? Thanks for any answers here!
No, you always must load them from the Google site. They offer no way to run Google Maps locally. The GMaps scripts are generated on the fly, based upon (among others, I'm sure) the HTTP_REFERER header of the request. That's how they can bind an API key to a specific website.

Google Analytics to track FireFox extension use

I'm developing a Firefox extension and would like to track its use with google analytics, but I can't get it working.
I've tried manually calling a function from ga.js, but that didn't work for some reason. No error was produced, but neither was any data collected.
My last attempt was to have a website that just holds the tracking javascript and then load it within the extension in an iframe with the URL configured so it contains meaningful data. This way the analytics are getting connected when I visit said webpage with a browser, but not in an extension. I've tried putting some visible javascript on the site and have confirmed the site's javascript is executing. This method also works with other trackers, but I don't like their output and would prefer Google Analytics.
Any ideas what else I could try to accomplish this?
The solution is to use Remy Sharp's mini library for tracking bookmarklets and extensions with Google Analytics. Works like a charm.
Usage is as simple as:
gaTrack('UA-123456', 'yoursite.com', '/js/script.js');
Note that, since it doesn't use cookies, there's no differentiation between pageviews and visits, or for that matter, between visits and visitors. But, the rest of the functionality is fairly reliable.
Depending on what you want to track you may not need Google Analytics. Mozilla's addon.mozilla.org portal already provides comprehensive tracking and usage statistics for addons.
To check if Mozilla provides what you need go to the Statistics Dashboard and choose the statistics for one of the publicly available addons.
Here is a small library to proxy the requests through an iframe hosted on another server: https://github.com/yelloroadie/google_analytics_proxy
This gets around the bug in the add-on sdk that causes ga.js to die (https://bugzilla.mozilla.org/show_bug.cgi?id=785914).
This method allows full use of google analytics, unlike the limited use found in the library by Remy Sharp.
I don't think this is possible. Firefox extensions don't allow you to load pages from other servers. So the only way I can think of is to have an invisible iframe load up the code. The pings to Google's servers need to be from a domain belonging to you. So I guess your own servers have to serve up pages every time a user loads the extension, which just kills your server and defeats the purpose of Google doing all the work!! Please post if you have found a way around it. Chrome extensions can be tracked easily!
For using analytics in the main/background script you might want to use this solution:
https://stackoverflow.com/a/17430194/193017
Citing part of the answer:
I would suggest you take a look at the new Measurement Protocol in Universal Analytics:
https://developers.google.com/analytics/devguides/collection/protocol/v1/
This allows you to use XHR POST to simply send GA events directly.
This will coexist much better with Firefox extensions.
The code would look something like this:

Categories