Chris Hannah

A Few Initial Notes on My Website Analytics Project

I’ve done some minor researching into this idea of mine, that really became a thing when I started making my blog super lightweight. And I really want to carry that over into whatever this project becomes.

Whatever I do, will of course be personally oriented, and it will be packed full of decisions that wouldn’t work best for most people. But it’s a personal project first, and if it becomes more flexible and open in the future, that’s just a bonus.

What To Track

With Google Analytics, you get a whole bunch of stats. This can be really handy for someone trying to deeply understand interactions with a website, but it’s a bit over the top for the menial use I want out of it. There’s also the added fact that you’re tracking your users — it’s not a big deal, but I’d rather not invade people’s privacy.

There are very minimal metrics that I want to capture, and that is page views, referrer websites, and possibly number of sessions – although I don’t care about this too much. But regarding the first two, this can be completed by simply telling something the page that’s been loaded, and what referred it. Luckily for me, it’s all in the HTML DOM and I think I’ll be able to do this super minimally.

The way’s this basic data could be used is also rather interesting to me, as when the message is received (by a server, or whatever), a date can be applied. Which means the data can be sorted by the date, collated into individual pages, and some pretty cool graphs could be made from it.

How to do it

For the sake of the front-end implementation, I plan this to be a simple PUT request, which will send the (as mentioned above) data to whatever server that is in control of the analytics. From there, it will require no more work from the client.

For the back-end, the speed, and “heaviness” of the implementation isn’t super important for me at the beginning stage. Because initially it will only serve myself, so it’s not a big load that will be put on it. But my first idea is to use a cloud server on Digital Ocean, to host a Swift server app! Built using Perfect, because I had a great experience with it when I experimented with a text formatting API. There’s also the fact that I am mainly a Swift developer, and is more likely to get finished if I make use of that.

Progress

As with all my other projects, I’ll be pretty vocal with the progress, and try to share as much as possible. This will be done mainly on Twitter, where you can follow me at @chrishannah, and if you want to know something I haven’t shared yet, just ask!

Small File Sizes and Quick Load Times

I’ve been getting more obsessed with these two things recently, and you may have already noticed it with the recent “redesign”, if you can call it that. Basically, the design has been simplified even more, and a higher focus (like everyone always says) has been put on the content.

I’ve had this mindset towards website sizes, and how fast they should load for quite a while. But it’s only the past week or so that I’ve put effort into sorting out my website.

It started with optimising the images on the website, which consisted of resizing every image so that the width didn’t exceed 1400px and height didn’t exceed 1200px. They’re not exactly small sizes, but we live in a Retina world, and I have to put up with that. On top of that, all PNGs were put through the highest compression in Squash 2, and any image that was currently on the front page (I really couldn’t be bothered to do this for every post), was converted to JPG.

It was a decent start, and it certainly made a noticeable change in the size, with it taking my home page from 6MB to 1.2MB. It’s a relatively big difference, but I still felt that it wasn’t near enough what I was aiming for.

My desire is to have my website show off the content really nicely, be measured in mere kilobytes, and load so fast it’s not even recognisable.

Fast forward to today, where both the size and load speed metrics have improved a lot. I’ve been playing around with a few static site generators, and thinking about doing a more custom approach to the website, but I realised that Ghost (what this site runs on) can be manipulated itself. So for now, nothing major has changed with the underlying blog engine.

I have done a few things though:

  • Removed Prism – this was the already small library that I used to style any embedded code, but it’s not really relevant.
  • Cleaned up and minified my CSS file (yes, I write basic css).
  • Removed all javascript, including Google Analytics!

Google Analytics was the hardest to remove, but I got down to a point a page showing a single text-only post, would be roughly 50KB. 29KB of that was Google Analytics. This was didn’t seem like nice ratio to me, so for now it is gone. Hopefully in the future, I can write something minimal myself to track basic page views, but I’m not worried about that just yet.

Here are a few examples of the website size and load speeds:

I’m really happy with the low page sizes, and it appears the only thing truly adding to the size now is the images, which I can deal with. I’ll just start to use them where the need to be used, and nowhere else. The load speeds varied across multiple attempts, so that’s why a range was given (caches were disabled).

My next step will be to try and further optimised the actual Ghost engine itself, to see if any speed improvements can be made there. And I guess maybe an improved cloud server would help also? Then there is the dream goal of custom web analytics.

So rest assured, for now, nothing is being tracked on this website.

I’d be very interested in hearing everyone else opinions on website sizes, and all the rubbish I’ve wrote here in this post. Because while I really want my blog to be under 10Kb in most scenarios, it probably doesn’t make a huge difference to the reader.

The AnyWatt USB-C Dongle

The AnyWatt comes in three versions: one for square-headed chargers, like those found on Lenovo laptops; one for more traditional barrel plugs; and perhaps most surprising, one for Apple’s MagSafe 2 adapter.

I really don’t see the amazement at this product, it’s just an adapter. Sure, the automatic voltage adjustment is nice. But if you have a Mac, are you really going to ask a Lenovo user for their charger?

Just bring your own.

Emergency SOS on Apple Watch

I had my third experience triggering Emergency SOS on my Apple Watch this morning, but this one was the most annoying.

If you haven’t heard of it, then iMore has a good guide on what it is and how to set it up. But basically, it’s something that when triggered, will start beeping loudly while it counts down from 10, and when finished it will call your local emergency services, and share your location with a rather urgent message to your emergency contacts.

To be honest, it sounds really useful. Not something that would get used 99.9% of the time, but it’s nice to know it’s there if you need it. However the action to trigger it, is by holding down the buttons on your watch. Which I believe, is a terrible idea.

As I mentioned before, I’ve accidentally triggered this a few times. I was pretty sure that I saw somewhere that the latest betas had an issue with cancelling it, I’m not sure if this is still true, but nothing I did stopped everything from happening. So my watch beeped loudly on the train for 10 seconds, the (not so equal to 911) emergency services were dialled, and my location was shared with a few people. All because I was leaning on my wrist in a weird way when trying to get off the train.

It’s a nice feature, and is vital to someone in an emergency. But it should be harder to trigger.

I’ve Been Writing Server-Side Swift!

I made my first API today, and I used Swift to do it!

Basically, I got bored this afternoon and decided to have a little research into server-side Swift programming. I’ve heard about this before, but I’ve not gone too deep into it myself.

The problem with me tying things like this, is that I ever really have a good idea, or scenario which I could use to learn the new thing. Well as you may already know, I’m slowly working on a title casing application for iOS and macOS, and therefore I’ve already created a few functions to format text.

So far the base TextCase functions are:

  • Uppercase
  • Lowercase
  • Title Case
  • URL Encoding
  • Mocking SpongeBob (yes, like the meme)

From these formats, the only ones I could see being useful are Title casing, and the fun SpongeBob format.

From making use of various APIs myself, I knew that all I needed was a super simple HTTP server, which had support for a few GET requests.

Perfect was the tool I used to write the server side code, and I found a quick tutorial which explained the basic HTTP server that I needed. I must say it was really easy for me to create this, as I’m already familiar with Swift, so the only thing to learn was the “Perfect” way of doing things.

Because it was in Swift, I could also reuse my main TextCase class which handles the formatting. There was a slight exception, where the arc4random_uniform function isn’t available on Linux, but I found a Linux suitable replacement for this.

There are also a few more reasons why I wanted to try this out, but they’re rather meta. For example, I’m a big fan of Swift, and it feels good working with “low-level” Swift if you can really call it that, and also because I just love the look of Swift in the default Xcode theme, with the SF Mono font 😍 (weird, I know, but it’s the truth).

The final code (as in what I’ve done so far), is three endpoints, which are actually just two. /title/{input text} is to return the given text in title casing, /spongebob/{input text} is for the SpongeBob case. The third one is just /{input text}, and it returns the text in every format available, which is just the two I mentioned so far. The results are in plain JSON, and also include the plain value that was sent in the request.

For example, here is an example response to the / endpoint:

{
    "plain" : "what the hell is this",
    "title" : "What the Hell Is This",
    "spongebob" : "wHAT ThE Hell iS thiS"
}

Anyway, you can view the project over at GitHub, and if you want to suggest any new formats (or even write some yourself), just let me know on Twitter at @chrishannah

Snapchat Can Now Share Your Location

Snapchat has just released a new feature, and it’s one that can be taken in a few different ways. It’s Snap Map, and basically it’s a way to share and view peoples locations.

To activate Snap Map, just pinch to zoom out, and you can view any of your friends that are currently sharing their location with you.

In their short video showing the new feature (Now unavailable), it seems as it’s being advertised as a way to see where your friends are, so you can go hang out with them.

But at the same time, it’s very easy to accidentally share your location with more people than you want. This becomes a much bigger problem with a service such as Snapchat, as the majority of users are very young.

Fortunately, there is a setting in Snapchat where you can limit who can view your location. I would suggest turning this feature off completely, but it’s not a problem if it’s managed properly.

So here is how to fine-tune your privacy preferences in Snapchat:

1st Method – From Settings

  1. When viewing your profile in Snapchat, press the settings icon in the top-right hand corner.
  2. Scroll down to the section labelled “WHO CAN…”.
  3. Tap on “See My Location”.
  4. You can then choose any location sharing options from here.

2nd Method – From Snap Map

  1. When viewing the map using Snap Map, press the settings icon in the top-right hand corner.
  2. You get moved straight to the location settings, where you can choose any sharing options.

Location Sharing Options

When sharing your location in Snapchat, there are three different options to choose from (of course there’s also the option to not share it at all, by never enabling the feature).

  • Ghost Mode (Location is hidden)
  • My Friends
  • Select Friends…

So you can either hide it completely, share your location with all of your friends, or just to a selected group. In some cases, “My Friends” is a completely fine option, but that only makes sense if you only add close friends. But if you like to add other people you don’t know very well, or you just want to completely sure who you’re sharing your location with, the latter “Select Friends” option is much better suited.

Extra Tips

  • When using “My Friends”, any friends added will automatically be allowed to view your profile.
  • When using “Select Friends…”, people you allow to see your location won’t be notified, they will simply be able to see you on their map.
  • Your location is only received while you are using the Snapchat app, and apparently not in the background.
  • Any location data is deleted after a few hours.
  • To clear your last locations, toggle Ghost Mode on and off. This will clear your past data, but keep your sharing settings the same.
  • The last tip – Just be careful who you’re giving your location to.

Track Your Steps With Walk More

My friend Cesare Forelli has just released his fourth app, and it’s a pedometer to help keep track of how far you’ve walked.

It’s a simple application, in that it’s primarily a way to view your walking data, but that’s not all it does.

It tracks your steps, the distance you actually walked, and if you’re on an iPhone 6 or newer it also shows you how many stairs have climbed.

This data is combined with a set goal, which is an amount of steps you want to hit every day. This is all presented in main ring, but if you swipe to the left you will also get to see the Stats view. Here you can find your past steps and distance walked, but also other data points such as the most steps walked, longest distance, and most floors in a single day.

There’s also a today widget, that let’s you keep on top of your walking at a glance.

I’m a big fan of the interface, and how it shows everything I need to see, and in a beautiful way.

Walk More is free to download on the App Store, but there’s also a few tip options in the settings, just in case you want to help keep the app going!

Social Media Accounts No Longer Integrated into iOS 11

Starting in iOS 11, users will no longer be able to associate social media accounts, such as Twitter or Facebook into the Settings app.

Previously, users could add an account to Settings, which would then allow other apps to request these details as authentication. Which was quite useful, as there are a lot of apps/services that authenticate via Twitter, and this meant you didn’t have to keep entering your password.

There is an alternative that developers can use, and that is the built in Keychain that can be used to store authentication details, such as username or password. And they can combine this together with the new additions to in app autofill, so that stored details can be loaded into the login form automatically.

This also means that the Social app framework, that developers used to initiate content sharing to built-in social networks has changed. Instead of providing a simple way to post to LinkedIn, Weibo, Facebook, is Twitter, it is now a generalised framework that can be manipulated to be used with any social account.

From the documentation:

On iOS and macOS, this framework provides a template for creating HTTP requests. On iOS only, the Social framework provides a generalized interface for posting requests on behalf of the user.

A common way to use this framework is:

  • Create a network session.
  • Get the activity feed for a user.
  • Make a new post.
  • Set properties on a post, add attachments, etc.
  • Publish a post to an activity feed.

So it’s still helpful, in that it can be used in more ways than before, and a general interface is also provided. But from the point of view of something like Twitter that was previously integrated, it will be a bit more work to integrate.

WWDC 2017

Firstly, that was an amazing keynote.

There were so many different features announced, that it just went super fast. I’m especially looking forward to finding out all the little things that didn’t make it.

I won’t be posting an entire summary of the event, as there’s loads more great writers doing just that. But I thought I’d share my brief opinion on a few things here, before any smaller pieces that I share here on my blog.

tvOS

Not much was announced for tvOS, apart from Amazon Prime Video. That’s pretty cool, and definitely something I’ll be using, but nothing really to give an opinion on.

watchOS

The watch faces were, apart from Siri, a bit uninteresting in my opinion. But the Siri face is something I’m really intrigued about.

I hope that the complications I use on my current watch face (Dark Sky, Overcast, and Todoist) can find ways to put their content in this view. It also looks like Apple have finally found something that makes good use of the Digital Crown.

I’m a fan of the new Activity features, as it’s something that can really benefit from being personalised.

The Music app looks pretty nice, with the same card style as the Siri face. But I don’t listen to music from my watch at all.

macOS

“High Sierra”, wow.

Again, just like tvOS, there’s nothing to really shout about with the latest update of macOS. Maybe that’s why they didn’t pay much attention to the name.

I’m sure they’ve added a lot of great features, but I just installed it on a second MacBook I have, and I didn’t notice anything different.

APFS is pretty cool though.

VR

There is however some great VR functionality, and it’s really pleasing to see Apple go full throttle into this industry.

New Macs

Quite a few new Macs, with some good improvements. But the real announcement was the iMac Pro, what a machine. It looks beautiful.

It’s way too powerful for what I use a Mac for, but Apple are truly moving forward in the pro market. 128 GB RAM and 18-Core processors just blow my mind.

I really need the space grey external keyboard and mouse.

iOS 11

Messages

I like the fact messages are now stored in the cloud, and that they managed it while still providing the same level of security as before.

Apple Pay P2P

Nice!

Siri

Some great improvements with the voices, and translation. But overall, Siri is becoming pretty clever!

Something I didn’t take in initially was that you now have “one Siri”, as the data is shared between your devices.

Control Center

I like this a lot! It’s a bit ugly, but it can do a lot more than before, and it’s even customisable!

AR

Could they have done this any better?

Interface

I’ve played with iOS 11 a tiny bit so far, and the interface is really clean.

The multitasking is a lot better than before, and the Dock just makes it so easy.

When I was first playing with the beta on my iPad, I found it a bit confusing when how to activate Split View when viewing an app. But it’s a nice way to do it, and having an app “over” another is really helpful. I guess it will also help when apps don’t support Split View, so you’ll still be able to have something above.

Drag and Drop

It’s a drag fest. – Craig Federighi

All of this just makes sense, the multiple file selection, moving them between apps, it just feels perfect for iOS.

Arranging icons on the home screen is also easier because of this as well, because you can pick up an app, and swipe between screens whilst holding the app!

Files

😍

Markup

I use this quite a bit already, but it’s way more powerful in iOS 11.

I love that when you take a screenshot it let’s you activate it right away as well, that’s all I use Markup for!

New iPads

Great new iPads. I need one.

HomePod

It’s a speaker and a voice assistant, but at the same time it’s so much more.

I have an Amazon Echo, but because it’s not integrated very well into the Apple ecosystem, I hardly use it.

And while I don’t think this is worth purchasing just for Siri, if I ever move out, this would be a perfect addition.