Skip to content
Browse files

Add bandwidth and metered as well from connection

  • Loading branch information...
1 parent 42df79d commit c075df25b59bfdb3707a407aa1e941b662b12145 @bluesmoon committed
Showing with 15 additions and 1 deletion.
  1. +15 −1 plugins/mobile.js
View
16 plugins/mobile.js
@@ -3,4 +3,18 @@
Plugin to capture navigator.connection.type on browsers that support it
*/
-BOOMR.addVar("mob.ct", (typeof navigator === 'object' && navigator.connection) ? navigator.connection.type : 0);
+(function() {
+var connection;
+
+ if(typeof navigator === 'object') {
+ connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection || navigator.msConnection;
+ }
+
+ if(!connection) {
+ return;
+ }
+ BOOMR.addVar("mob.ct", connection.type);
+ BOOMR.addVar("mob.bw", connection.bandwidth);
+ BOOMR.addVar("mob.mt", connection.metered);
+
+}());

0 comments on commit c075df2

Please sign in to comment.
Something went wrong with that request. Please try again.