After my favorite web stats software was sunsetted by its developer, I knew it was only a matter of time before I moved on to something newer. I did that late last year when I uninstalled Mint from my Media Temple server and installed Jetpack on Initial Charge. This site now makes use of Jetpack’s built-in stats feature that’s powered by WordPress.com.
I’ve been pretty happy with it so far. The feature is lightweight — adding just over 2.5KB to my webpages — and offers most of what I would want in this type of software while still remaining respectful to site visitors. I wouldn’t mind getting a bit more information about the operating systems, web browsers, and screen resolutions used by my readers — for web design purposes — but I’d rather err on the side of collecting less than collecting more.
There was one additional thing that was missing in the transition from Mint to Jetpack — a quick shortcut to my stats from my iPhone home screen. For years I had an icon on my home screen that would load directly into my Mint installation’s interface so I can peruse my stats without having to launch my browser and type in the URL or open a bookmark. Jetpack doesn’t really have anything like that.
The WordPress app has a pretty nice interface for viewing Jetpack and WordPress.com stats, though. But there wasn’t anything immediately obvious within the app — such as a URL scheme — that I could use to launch directly into that interface. It had to exist, though. You see, the WordPress app includes a Today View widget that can display the daily stats for a single site. And when you tap on the site name, it launches the WordPress app into a modal view of that site’s stats — something that, from what I can tell, is only surfaced when you open the app from the widget.
I was curious if the app was using a URL scheme for that and decided to do some investigating in the app’s source code, which is freely available to browse on Github — open source is so great. After a bit of digging, I found the code that was used for this and to my surprise, it does use a URL scheme:
The Today View widget uses that URL scheme along with the chosen site’s site ID to launch that slick modal stats view. The trick from here is finding your site’s site ID, which you can then plug into the end of the URL and use for all sorts of purposes, such as building an iOS shortcut. But how do I find my site ID, you might ask? By visiting your site within a web browser (when logged out of WordPress or from within an incognito/private browsing window) and using “View Source” on your homepage.
The stats code is automatically added to your footer and should be listed like so:
This is the source for Initial Charge’s homepage and you can see my site ID listed after
blog: within the code. So in the example of my site, to launch directly into my stats within the WordPress app I use the following within a shortcut:
Of course, you won’t see anything if you try and open that URL scheme on your device, since it is setup to display my site’s stats, you’d need to be logged in to my WordPress.com account for it to work. But after finding your site ID and logging in to the associated WordPress.com account — that you used to setup Jetpack — you’ll be able to launch directly into the WordPress app to see your site’s stats.
The neat thing about this little URL scheme, though, is that it doesn’t just work for WordPress sites that run the Jetpack plugin for stats. It can also be used by any WordPress.com site — since they both use the same stats system and application for viewing.
To put this all together into something a bit more useful, I’ve put together a shortcut that asks for your site ID when importing and can be used to launch directly into your site’s stats within the WordPress app. You can download the .shortcut file, or for you thrill seekers out there, you can download the shortcut from iCloud.
Once you have it all setup, you can launch it from the Shortcuts app itself, from the app’s Today View widget, or by just about any other means. I have mine added to my home screen using this custom icon, so I have quick access to it on my iPhone and iPad — just like I had with Mint.