How to track page views in a SinglePage App

The google analytics snippet tracks regular page views every time the page gets reloaded. That happens if you navigate to another page or your reload the current page.

But if you have a AJAX heavy SinglePage Application, for example build with Backbone.JS or ember.js, than the default code snippet from Google is not enough. Another use case is if you want to track a JavaScript/CSS popups in Google Analytics.

Well. All you need is the default GA snippet. Which looks like this.


var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXX-Y']);
_gaq.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

The good thing is that you can trigger page views with the JavaScript Google provides you. All you need to do is to trigger this code.

  _gaq.push(['_trackPageview', '/popup']);

The last parameter is a fictional path. This is what you will see in the analytics. You could call this code in the “onclick” event of a button or link. I wrote this convenience method.


function page_view(path){
 if (_gaq){
   _gaq.push(['_trackPageview', path]);
 } else {
   ga('send', 'pageview', path);
 }
}

With that I am now able to track JavaScript popups, click on js/css Tabs and clicks in SinglePage Applications. All visible in Google Analytics.

KPIs for Software Libraries

This week we launched a new detail view for all our software libraries at VersionEye.

Screen Shot 2013-09-12 at 4.51.29 PM

The new view is more clean and shows some important KPIs for software developers on the right side. It shows for example how many days/weeks/months/years ago the selected version of the library was released. If the current version was released 1 year ago it is very likely that the project is not longer maintained any more. And you should use software libraries which are not maintained anymore.

Another KPI is the average release time. If the average release time is less than 1 month and the current version was released less than 1 month ago you can be sure that the project is still active. You can report bugs and change requests and the core committers will reply and help you.

Another KPI which is an indicator for a high quality software library is the number of references. If 10K other artefacts are referencing a software library it is very likely that the project is very good.

I am very interested in feedback to this new detail pages. Let me know what you think.

VersionEye Collaborators

One of the coolest features we added in the last days to VersionEye is the collaboration feature. Maybe you noticed already the “Collaborators” Tab in the project view. Here you can add a collaborator to your project. Simply start typing the full name or nickname of the collaborator. The autocomplete input field will show you some suggestions.
If your collaborator is currently not singed up at VersionEye you can fill in an email address and send him an email invitation.

Screen Shot 2013-09-12 at 4.42.26 PM

The collaborators will now also receive email notification to your project. Every collaborator can configure the frequency of the notifications in the “Settings” Tab.

This feature we build for distributed teams and we use it by ourselves.

Switch for All Repos

We did some changes on the GitHub Single Page App at VersionEye. Up to now we only supported Repositories with the languages we support at VersionEye. That means we have read the repository language via the GitHub API and if it was one we support we showed an active “switch” widget you could turn on or off. In practice this caused sometimes some errors. That’s why changed the behaviour. The “switch” widget is now always active. You can turn it on in any case and VersionEye will try to find a project file in the root of your repository.

Screen Shot 2013-09-12 at 4.20.17 PM

HTTP_REFERER for RSpec is missing

Currently got this error message after executing my RSpec tests:

ActionController::RedirectBackError:
 No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env["HTTP_REFERER"].

The error message and Stackoverflow tells you to set request.env[“HTTP_REFERER”]. I did that:

request.env["HTTP_REFERER"] = "/signin"

But that didn’t helped. Instead of that I set the HTTP_REFERRER directly in the post. Here is the snippet from my test code:

post "/sessions", {:session => {:email => user.email, :password => user.password}}, {"HTTPS" => "on", 'HTTP_REFERER' => '/signin'}

That fixed my problem.

Background image for developers

On Friday I pushed a new version of VersionEye online with a big background image from Berlin. Because we have our head quarter in Berlin. This is how it looked like:

Screen Shot 2013-08-04 at 6.49.51 PM

It took less than 2 days until the first users from the community complained about it. They told me that it is to disturbing and they would prefer and simple grey background.
OK. Lessons learned. Just removed it from all pages but the landing page.

More changes on the landing page are coming soon.

AbstractHttpClientWagon.getReadTimeout()I

I am currently writing a maven plugin and I got this error message by executing the goal.

[ERROR] Failed to execute goal group:artifact:1.0.0:goal (default-cli) on project artifact: Execution default-cli of goal group:artifact:1.0.0:goal failed: An API incompatibility was encountered while executing group:artifact:1.0.0:goal: java.lang.NoSuchMethodError: org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.getReadTimeout()I

I could resolve this after I updated from maven 3.0.3 to maven 3.0.5. The current version is solving this problem.

Language Pages

This week we just pushed the language pages online at VersionEye. Now the language icons below the search bar are clickable.

Language Pages at VersionEye

 

On the every language page we display the 10 hottest and the 10 latest libraries. And we show people from the community who like that language. Here is an example for Ruby.

Ruby at VersionEyeCheck it out and let me know what you think.

Java HTTP Post file upload

This is the java code to upload a json file via HTTP Post. I am using for that the HttpClient from Apache.

byte[] data = outStream.toByteArray()
HttpClient client = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("http://localhost:8080/YourResource");

ByteArrayBody byteArrayBody = new ByteArrayBody(data, "application/json", "some.json");
MultipartEntity multipartEntity = new MultipartEntity();
multipartEntity.addPart("upload", byteArrayBody);
httpPost.setEntity( multipartEntity );

HttpResponse response = client.execute(httpPost);
Reader reader = new InputStreamReader(response.getEntity().getContent());

Geek 2 Geek

I am just starting a new MeetUp in Berlin. Called Geek2Geek! 🙂

Geek2Geek

Why? 
There are already many tech meetups in Berlin. There is a MeetUp for PHP, Ruby, Java, JavaScript and so on. And at the Ruby MeetUp you have only Ruby devs talking about Ruby and at the PHP MeetUp you have only PHP Devs talking about PHP! But I think it is much more interesting if people from different communities are coming together and discussing a topic!

How? 
Every Geek2Geek Event has 1 topic! For example MVC in Web Apps. To this topic we will have at least 2 talks from 2 different communities. For example one talk about Ruby on Rails and another one about Grails. The room will be mixed with devs from at least 2 communities. And after the talks we can have a productive controverse discussion by Pizza and Beer!

Where? 
At the VersionEye Office in Berlin Mitte: Brunnenstrasse 181!

When? 
23 July 2013

Sign Up
Sign up at our MeetUp page: http://www.meetup.com/geek2geek/

New VersionEye API

VersionEye is releasing the 2nd version of his API. Check it out here: https://www.versioneye.com/api?version=v2. The only thing that changed is the way how you access the products.

Screen Shot 2013-07-10 at 9.26.15 AM

Because the URL structure changed at VersionEye, the API needed some refactoring to. The old version is still working! And the other parts of the API are not changed. The file upload via API for example stays as it was.

GitHub Single Page with many improvements

The GitHub Single Page app at VersionEye is now online since 2 weeks. In the mean while we collected a lot of feedback from the community and did many small improvements.

Screen Shot 2013-07-05 at 11.53.27 AM

 

Here are the most important changes:

  • We re arranged the design a little bit. The toggle component is now on the left side.
  • All branches from a repository are now in a scrollable div.
  • By default we sort the repositories by the last activity. That means the repository your worked the last on, is now on the top.
  • There was a bug in the filter if switching between Organisations. That is fixed now!
  • We improved the performance. The initial load is now a little bit faster.

We are still relying on your feedback!

New Dependency Badges at VersionEye

Yesterday we just pushed again a new version of our dependency badges online. They look now like this:

dep_out-of-date dep_unknown dep_up-to-date dep_update

They are now conform with all the other badges at github. That means they are the same style and they have the same height, 18px. Currently VersionEye offers this badges for Ruby, Java, PHP and Node.JS. You can find them already on some GitHub pages:

https://github.com/Ocramius/ProxyManager
https://github.com/versioneye/naturalsorter

Feedback is welcome 🙂

New URL structure at VersionEye

This week we pushed a new version online where we completely changed our URL structure. Until last week we had URLs like this:

http://www.versioneye.com/package/prod_key/version/version

For example:

http://www.versioneye.com/package/rails/version/3~2~13
http://www.versioneye.com/package/org~hibernate–hibernate-core/4~2~0~Final

They look now like this:

http://www.versioneye.com/ruby/rails/4.0.0
http://www.versioneye.com/java/org.hibernate:hibernate-core/4.2.0.Final

VersionEye allows now dots in the parameters and we removed the static strings “package” and “version”. The URLs are now much shorter!

We wrote some redirect rules for the old URL structure. All old URLs are still working and will be redirected to the new URL structure. We tested the redirect rules with unit tests, but if you now a case there it doesn’t work, please let me know!

Single Page App for GitHub Repositories

We just deployed a new version of VersionEye. In the current version we totally refactored the handling with GitHub Repositories. We developed a single page application to deal with GitHub Repositories inside of VersionEye.

Screen Shot 2013-06-26 at 4.33.29 PM

By Default we show all your public repositories from your user account. If you want to monitor a repository, simply select the branch and turn the switch on!

In the Menu “Organisations” you can switch between your organisations, user account and team repositories.

Screen Shot 2013-06-26 at 4.34.38 PM

If you have a high number of repositories in an organisation you can filter by language. In that way you see only repositories with the selected language.

Screen Shot 2013-06-26 at 4.34.59 PM

But most awesome feature is branch selector. Up to know VersionEye was only able to monitor the master branch. But now you can select any branch on your repository!

This is all pretty new. We rely on your feedback. Please let me know how you like it.

Better support for PIP requirements.txt

Just pushed a new version of VersionEye online with an improved parser for requirements.txt files.

python-logo-glassy

Here are the new features:

  • It can handle comments in requirements.txt files.
  • It will ignore lines who are starting with http:// or https://.
  • It can handle entries without explicit version string.
  • Support for the pip.log file.

An entry like this here is easy:

requests==0.9.0

But now other comparators work, too. For example this here:

amqplib>=1.0.2

Or if you have only the package name. Like this:

amqplib

And the current version will also handle the pip.log file. You can just upload it or put in the URL to your pip.log file and it will show you all the dependencies in the pip.log file.

Feedback welcome.

Linux Tage 2013 in Berlin

Linux Tage 2013 in Berlin is the biggest Linux Conference in Germany. It goes from Wednesday to Saturday. There are all day long sessions & tech talks. And of course a big exhibition hall, where you can meet some of the vendors. It is a place there .com meets .org.

I have been there today and will be there tomorrow and on Saturday. You can find me at the Yunicon stand in the exhibition hall. Yunicon is an awesome private cloud provider from Berlin. They have the coolest stand in the exhibition hall because they offer free cocktails! 🙂

LinuxTage_VersionEye

I am doing every day at 15:30 a talk about Continuous Updating with VersionEye.

LinuxTage_VersionEye_Talk

If you want to learn something about Continuous Updating or VersionEye, join the talk. Grab a free cocktail and ask me your questions. I am happy to answer them.

LinuxTage_VersionEye_TechTalk

See you tomorrow.