I Thought He Came With You is Robert Ellison’s blog about software, marketing, politics, photography, time lapse and the occasional well deserved rant. Follow along with a monthly email, RSS or on Facebook. About 7,250,102,787 people have not visited yet so it might be your first time here. Suggested reading: Got It, or roll the dice.

HOWTO: Fix Twitter

HOWTO: Fix Twitter

Wired (and everyone else) is reporting that Twitter is finally testing longer tweets. Maybe 280 characters! I had a better fix six years ago:

ITHCWY: Twitter: Put some status in status updates: Give me an extra character for every year that I’ve been with… http://goo.gl/fb/gCEpT

— Robert Ellison (@abfo) July 8, 2011

Why Microsoft is Likely Doomed Based on one Email Folder

Close up of the useless Junk folder in Microsoft Outlook

When you get a piece of spam in Outlook you move it to Junk or block the sender. And then, even if that junk mail is marked as read, the Junk folder has a BOLD MESSAGE COUNT. It's the only folder that does this. I cannot do any other work while I have a bold message count and so I have to switch to the Junk folder and delete the message to get rid of it.

Regular email: read, file, done.

Junk email: recognize as spam, click block sender, confirm that I really want to block the sender, switch to Junk folder, mark as read, delete.

Something is really wrong with this workflow. It's a lens through which you can view the ultimate demise of the company. Sure, Office isn't going away soon and Azure is growing like crazy and SQL Server runs on Linux. But somewhere in Redmond 5,000 people designed a Junk email folder that is the MOST IMPORTANT folder in Outlook. The rest were presumably too busy making Windows Update worse to stop this.

My Google experience is that I really don't get much spam. The spam that I do get is hidden from me unless I actually need to rifle through it for some reason. On the occasion I actually get legitimate junk I just flag it as such and never have to touch it or it's ilk again.

Email Alerts for new Referers in Google Analytics using Apps Script

Referral Traffic in Google Analytics

It's useful to know when you have a new website referrer. Google Analytics is plagued with spam referral and you want to filter this out of reporting as quickly as possible to stop it from skewing your data. It's also helpful to be able to respond quickly to new referral traffic - maybe leave a comment or promote the new link on social media.

The script below will send you a daily email with links to any new referrers.

var TableId = 'ga:your-view-id';
var SendEmailTo = 'your-email-address';

function main() {
  var scriptProperties = PropertiesService.getScriptProperties();
  var currentProps = scriptProperties.getProperties();
  var anythingNew = false;
  var newText = '';
  
  var yesterday = Utilities.formatDate(new Date(new Date().getTime() - 24 * 60 * 60 * 1000), Session.getTimeZone(), 'yyyy-MM-dd');
  var options = {
    'dimensions': 'ga:fullReferrer',
    'filters': 'ga:medium==referral',
    'max-results': 20000
  };
  var report = Analytics.Data.Ga.get(TableId, yesterday, yesterday, 'ga:sessions', options);
  if (report.rows) {
    for (var i = 0; i < report.totalResults; i++) {
      if (!(report.rows[i][0] in currentProps)) {
        Logger.log('Found new referrer: ' + report.rows[i][0]);
        scriptProperties.setProperty(report.rows[i][0], report.rows[i][1]);
        anythingNew = true;
        newText += 'New referrer: ' + report.rows[i][0] + '\r\n';
      }
    }
  } else {
    Logger.log('GA report is empty');
  }
  
  if (anythingNew) {
    MailApp.sendEmail(SendEmailTo, 'Found new referrers for ' + TableId + ' on ' + new Date(), newText);
  }
}

Start a new apps script project in Google Drive and paste in the code. At the top enter the view ID that you want to monitor and the email address that should receive reports.

Choose Advanced Google Services from the Resources menu and switch on the Google Analytics API. Then click the Google API Console link and enable the Google Analytics API there as well.

Finally pick Current project's triggers from the Edit menu and trigger the main function daily at a convenient time.

This script saves known referrers in script properties. For a site with lots of traffic this may run out of space in which case you might need to switch this out and write known referrers to a sheet instead.

Get an email if your site stops being mobile friendly

Get an email if your site stops being mobile friendly

Google just released an API for the mobile friendly test and so I've whipped up a script to send an alert if a web page violates their guidelines. This will run the test as often as you like and send you an email if it detects a problem. Alternatively if you're not mobile friendly it will keep emailing you until you fix any problems which might be a good motivational tool.

First start a new apps script project in drive and paste in the code below:

var urlToMonitor = '';
var alertEmail = '';
var runTestKey = '';

var runTestUrl = 'https://searchconsole.googleapis.com/v1/urlTestingTools/mobileFriendlyTest:run?key=';

function mobileFriendlyMonitor() {
  try {
    
    var postBody = {
      'url' : urlToMonitor
    };
      
    var options = {
      'method' : 'post',
      'contentType': 'application/json',
      'payload' : JSON.stringify(postBody)
    };
    
    var response = UrlFetchApp.fetch(runTestUrl + runTestKey, options);
    var json = response.getContentText();
    var mobileFriendlyResult = JSON.parse(json);
    
    if (mobileFriendlyResult.mobileFriendliness != 'MOBILE_FRIENDLY') {
      sendEmail('Mobile friendly test failed for ' + urlToMonitor + ', check https://search.google.com/search-console/mobile-friendly for details');
    }
      
  } catch (e) {
    sendEmail('mobileFriendlyMonitor failed for: ' + urlToMonitor + ' with error: ' + e.message);
  }
}

function sendEmail(msg) {
  MailApp.sendEmail(alertEmail, 'Mobile Friendly Monitor Alert on ' + Utilities.formatDate(new Date(), "GMT""yyyy-MM-dd'T'HH:mm:ss'Z'"), msg);
}

There are three variables you need to set, urlToMonitor is the full URL of the page to test, alertEmail is your email address (or whoever needs to be pestered) and runTestKey is the API key for the service. To get this go to the Google API Console, click Enable API, search for 'Google Search Console URL Testing Tools API' and click enable. Then click the Credentials option and generate a browser key.

Once you've configured the script choose 'Current project's triggers' from the Resources menu in apps script and set up a schedule for the mobileFriendlyMonitor() function.

If You Give a Browser a Cookie

If You Give a Browser a Cookie

If you give a browser a cookie, it’s going to ask for local storage.

When you give it the local storage, it’ll probably ask you for a list of system fonts. When it’s finished, it’ll ask you for your screen resolution.

Then it’ll want to look to see if Flash cookies are supported. It’ll probably create a local shared object.

When it’s finished with the local shared object it’ll want more things to hash. It will hash your timezone and language. It might get carried away and hash every supported plugin. It may even end up hashing the platform and user agent.

When it’s done it’ll probably want to check out your WebGL. You’ll have to tell it your WebGL vendor and renderer. It’ll probably ask you to open a HTML5 canvas.

When it looks at the HTML5 canvas, it’ll get so excited it’ll want to draw it’s own hidden image. Then it’ll want to hash the image as well.

Looking at the image will remind it that it should store the hash somewhere. So it’ll ask for local storage.

And chances are if it asks you for local storage, it’s going to want a cookie to go with it.

(With apologies to Laura Numeroff, and you may be a snowflake yourself).

Subscription Economics

Subscribe to The Economist today and receive a FREE portable phone charger - ad seen on Facebook

I think I'd be more likely to subscribe if you'd take a charger away. Most right thinking gadget vendors don't even include them anymore.

Even better than threatening to send me e-waste: skip the news bit (it's already stale) and send my Kindle a monthly compendium of analysis.

Routers to defend against rogue IoT devices

Routers to defend against rogue IoT devices

A few months ago I wrote about my cunning plan to stop Internet of Things botnets: stop them at the router.

It's just possible that these were in the works before that post but Symantec, BitDefender and Intel unveiled router level IoT security at CES this year. Not as hard core as my plan, but looks like a useful start.

(Image from Norton Core website).

Securing the Internet of Things

Securing the Internet of Things

We can’t trust manufactures to build secure connected devices and so routers need to be updated to solve this problem once per network.

The distributed denial of service (DDOS) attack on Friday, October 21 was apparently caused by dodgy webcams. But next time it will be Nest or Alexa or Hue - not picking on Google, Amazon or Philips specifically here, those just happen to be the IOT devices currently plugged into my home network. My washing machine and drier would be as well but fortunately LG’s dismal app has saved me from myself by not working for toffee. Oh, I have some DropCams too. And my car is connected. The next attack will probably just come from me.

My fix: update routers to sandbox these devices. A Nest thermostat can only talk to nest.com. If it wants to DDOS Reddit too bad, no connection allowed no matter how badly the device is compromised.

When a new device is connected the router looks it up (MAC address registry?) and then puts it in the appropriate sandbox.

If Nest needs to connect to weather.gov to check the forecast then Google would need to proxy this via nest.com. If the device goes bad it’s only got one domain to attack (so there’s a pretty good incentive for the manufacturer to make sure it doesn’t).

The only downside is new routers or new router firmware. Given the current state of IOT I’d buy one.

As usual if any of my billionaire investor readers are interested get in touch.

Google I/O 2016

An Echo knockoff and rapturous applause for variable font size in a messaging app. Not much innovation so far this year.

The horrific trend in Inbox and now Allo is machine learning auto reply so you can send something canned and inauthentic instead of actually speaking with people. Zombie Robs might approve but I'm far from convinced.

Updated 2016-05-18 14:12:

Android N looks super cool and I can't wait. The #1 productivity enhancement I'd like to see though is copy and paste icons that look like copy and paste. I do not have a clue currently.

Updated 2016-05-18 14:24:

No headset.

Updated 2016-05-18 14:40:

Android Studio is very nice. Eclipse was painful. I actually like Android Studio more than Xamarin which is saying a lot for a C# leaning person.

Chromecast won't connect to wifi - finally found the fix

Chromecast won't connect to wifi - finally found the fix

I've struggled for a while with Chromecast. The idea is great. I love using my phone rather than a remote. I like the idea of being able to cast any screen or browser tab in principle (in practice I think I've only done this once). I like the nice curated background pictures and that I could get round to using my own photos one day.

But here is how it works in practice. Fire up app. Select Chromecast icon and watch it go through the motions of connecting. Nothing streams. Reboot Chromecast, phone and router. Hard reset Chromecast and configure from scratch again. Reboot everything some more. Disconnect house from grid for ten minutes and switch off gas mains as well to be on the safe side. Finally, streaming! Repeat.

It's miserable. With both a Chromecast and a Chromecast 2 (which I really hoped might fix the problem). I've been through two different routers and I've tried a bunch of different settings but nothing seems to make the thing work. I even renamed the device to remove spaces.

For a while I considered buying an OnHub. Maybe Google's router would work with Chromecast? But it can't be bothered with Ethernet ports for some reason and so I'd need a new switch and then I'd probably need another power port and how important is John Oliver right now anyway (very)?

As much as I want Chromecast to work I've binned the wretched thing and bought an Amazon Fire TV Stick. Same basic principle but with apps on the device rather than your phone and a remote control.

I'd rather not have another remote, but it works instantly and without risking an aneurysm. It's also available with voice control which lets you both search for programs and trigger Alexa (my typical morning is asking Alexa for a flash briefing and then sobbing quietly when a daughter yells 'Alexa, stop... Alexa, play Gangnam Style').

My only gripe so far is that the voice search doesn't search inside non-Amazon apps (Netflix, HBO, etc).