We love stats at Automattic. They’re key to understanding our users, and a driving force behind a lot of what we do.
When we make a change, we measure its impact and use the metrics to make data-informed decisions. For example, we recently improved how our Publicized posts look on other services. Using our own data as well as data provided by our partners, we made further improvements and tweaks to increase click throughs to your posts.
Our partners and those building on our platform should have the same ability. That’s why we spent the past few weeks creating tool to support them: WordPress.com Insights.
Check it out in the short video below:
Music Credit: Anthony Vitale
Insights provides data and graphs for a variety of metrics: Connections/authorizations, API calls, API errors, posts published, WordPress.com Connect Logins, and the reach of posts published from your app. By exposing this data, developers can measure the impact of their integrations over time.
In addition to graphs, we’ve also built in export functionality allowing you to get your data in CSV format. Since Insights is built using the REST API, you can pull data out in JSON format as well.
To accompany Insights, we also added the ability to allow other users and developers access to your app. To edit your permissions, head to the Apps Manager, select an application, and click “manage users.” If you want to provide temporary access you can also generate sharable URLs.
For more information and a walkthrough of Insights, check out our documentation.
We’ve recently made some updates to the REST API which is available here on WordPress.com and for any Jetpack-enabled site that have the REST API module activated. The API now has full read and write support for custom post types and post metadata.
You can specify a post’s post type when you create or edit it. If you’re fetching a single post, you will receive its post type in the response. Of course, you can also specify a post type when fetching a series of posts. In all cases the parameter to use or look out for is
You can also query posts by
metadata using the new
meta_value parameters. You can add, update, delete or retrieve a post’s metadata when creating, editing or getting a single post, using the new
metadata parameter which accepts an array of metadata
operations, based on the operation you are trying to perform.
In order to enable your custom post types to work with the REST API on your Jetpack enabled sites, you will need to whitelist them using the new
rest_api_allowed_post_types filter available in Jetpack, which is a simple
array of the post type names that should be allowed to work with the API.
All metadata keys can be accessed and edited by users with the
edit_post_meta (used for editing and viewing),
delete_post_meta capabilities as appropriate for each operation. We’ve also added a filter
rest_api_allowed_public_metadata that allows you to specifically whitelist certain metadata keys to be accessed (but not modified) by any user (even anonymous).
Here’s a quick rundown. If the user performing the request is unauthenticated, he or she will not be able to add, edit or delete any metadata; and will only be able to read specifically whitelisted metadata keys.
If the user performing the request is authenticated and has the above listed capabilities, he or she, will be able to read, add, edit or delete any metadata, even if it is not whitelisted.
In order to make it easier for you to add support for custom post types and metadata in your own plugins and themes, we’ve also added a third filter
jetpack_rest_api_compat in the main Jetpack file, which allows you to load additional files where you can then add all of your REST API compatibility code, using the filters above.
Because we love bbPress, we’ve bundled in support for bbPress and the REST API directly into Jetpack, so that you can read, write and edit bbPress forums, topics and replies right out of the box. You can also use this file as an example on how to bundle support in your own plugins or themes.
We have made a few recent additions to our posting APIs that allow more control when creating posts.
You can now
- Set a custom slug for the post permalink using the
- Disable or enable the publicizing of posts, or only publicize to certain services (Twitter, Facebook, etc) using the
- Pass a custom message to the above publicize services using the
- Set the status of a post as “pending review” by passing
When getting a post you can now
- Find the featured image for a post using
featured_imagewhich will return a URL.