I have a couple of Github projects that I want to be able to track the traffic to. I have done this in the past by adding Google Analytics tracking code to each wiki page. However, the Github wiki upgrade in September broke this and I don't seem to be able to add Javascript code to my wiki pages anymore.
A couple of random other points:
1) I'm aware that Github probably blocked JS on the wiki for security reasons.
2) I know Github provides its own very basic traffic graph but I would like all the power of GA.
Is there any way for me to restore Google Analytics tracking to my Github wiki? If not, is there an alternative?
You could leverage the Google Analytics for Mobile strategy.
The draw backs are that :
You would only be able to manually publish static image urls in for each wiki page.
You would need to host the Google Analytics for Mobile server-side file on another server. Somewhat negating the whole exercise.
Lately, the "Traffic" feature is unavailable.
In order not to implement something of your own, I have created githalytics.com
which let you "add" google analytics to your github repository.
Of course there are limitations and drawbacks as mentioned before.
Free free to check
Note that since January 2014, GitHub provides Traffic Analysis with a bit more information, for all pages of your repo (including commit activity, wiki, ...):
"Introducing GitHub Traffic Analytics"
In 2019, Tim Qian mentions in the comments:
The only problem is it only stores traffics for 14 days.
To resolve it, I made a tool to record it: repo-analytics.github.io.
You can either use Github traffic analysis (see VonC answer) or ga-beacon, a project by Ilyah Gregorik.
Create a new web property in analytics
Bind it to https://ga-beacon.appspot.com/
Add this markup to your pages (replace UA-XXXXX-X, your-repo and page-name):
[![Analytics](https://ga-beacon.appspot.com/UA-XXXXX-X/your-repo/page-name)](https://github.com/igrigorik/ga-beacon)
This will display a badge in your wiki page, but you can also use a single-pixel image.
The other alternative is to include an external image on each of your wiki pages. Then, track the image download stats.
You could then host the images on an image hosting provider that allows:
Download stats
SSL Support - If you link to an external image that
Hotlinking
I'm still searching for such a image hosting provider which provides all of this. I will post back once I find a suitable one.
i posted my research here: https://stackoverflow.com/questions/12795081/i-want-to-track-page-views-on-my-github-wiki-pages-any-suggestions-for-an-ima?lq=1
As an alternative to ghalytics.com, I also came across BitDeli Github Badge:
https://github.com/bitdeli/profile-ghbadge
It's pretty much the same thing, except it uses BitDeli as the analytics engine instead of GA.
Both suffer from the same apparent limitation: they can not capture the referrer header, since you need JS to extract that. This means that you cannot do analysis on search keywords, sites that link to you, or social network sources. Which is one of the main uses of GA, in my opinion.
The only workaround I can think of is to create a different landing page for your repo than README.md, and then hope that all your traffic will come through the landing page instead of directly to your repo. This landing page could just be a URL shortener (eg bit.ly) with its own analytics service, or a github-pages site with a GA snippet.
Related
I've written some code that retrieves some data from google sheets then updates some content on my google sites. However, while the script works (when run on localhost) I encounter the
"details": "Not a valid origin for the client: https://966655698-atari-embeds.googleusercontent.com has not been whitelisted for client ID MY-ID. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID."
However, I enabled this for localhost, cleared my caches. The problem is the 'https://966655698-atari-embeds'. Each time the google site loads it generates a new random number sequence. Does anyone know how to workaround this? The google site uses embedded html which I believe is why the initialization failed.
I have tried to white-list https://googleusercontent.com which didn't work (I didn't think it would because the domain changes) but I'm honestly incredibly stumped.
Google hosts all user content using their somedomain.googleusercontent.com. I do not know for certain, but I'm almost sure that to save space they dynamically host their content, meaning that when the embedded html does not need to be actively hosted, it isn't. I had to find a way to host from a site that would always send the request. For me, I found that github pages was the answer.
I found this on adobe's website which somewhat explains what googleusercontent does. https://helpx.adobe.com/analytics/kb/googleusercontentcom-instances.html
To set up github pages this link will explain how to do so https://guides.github.com/features/pages/
You can add this to the developer Google console relatively easily and any connection will submit from your username.github.io. (I believe it also uses https protocol). It also allows me to implement directly using git version control and implements nicely with WebStorm.
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.
This question may be not related to exact software stack, framework or language.
For my current project, we are using AngularJS to build the front-end that has a constant entrance page to load real data and render, which is easy for CDN and good for fast loading speed from browser side. But for some social feature, such architect may result in some problem. For example, when you paste your interested link to Facebook portal to share, Facebook will grab your page and show up a preview. If a landing page is empty, such preview won't work.
(I heard that Google+ recently support rendering javascript logic at server side before send back a preview, but obviously it's not a common support for other similar services. Google.com also supports indexing js based one-page application.)
Is there a better solution to solve this problem gracefully rather than fallback to have dynamic page which includes real data? Have I missed something in understanding this problem?
========
... I was even thinking of that, for requests that identified as FB request (like user agent), redirect it to a special gateway that wrapping sth like PhantomJS, fetch the page, render it server-side, and send back a DOM tree snapshot as content for FB to generate preview. But I also doubt that it's a good direction. : (
We are in the same situation. The simple solution is to use Open Graph meta tags in the pages your server will serve to Facebook scrapers.
Basically you need to do server-side what your web app is doing client-side. Amount of work highly depends on your hosting technology (MVC makes it super easy), your URI format and the APIs you use.
You will find some explanations here:
https://developers.facebook.com/docs/plugins/share-button/
Open graph introduction:
http://ogp.me/
I wonder how one would monitor a single page web app so you can see what the user does in your app, what "pages" he visited etc.
Kinda like Google Analytics with statistics for a lot of things.
Google Analytics is great for this. Check out custom events: http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html
It takes a fair amount more work than the "set it and forget it" type tracking you can do with traditional websites, but it's also pretty easy.
It will not 'just work', you need to be calling trackPageView to make the requests count as pageviews and include all the visitor information that would be included (not trackEvent). This gist is an old but popular solution to ajax navigation showing how to call trackPageView. It is called right after the content from the new url is injected into the page, so an equivalent in a framework like Backbone.js would on view initialization, like suggested in this guide.
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: