I recently argued with a friend about the best time of day to post on Instagram to maximize the number of likes on a given picture. We agreed that people view Instagram most frequently in nighttime hours, from around 8 to 11 PM.
I posited that the best strategy was to post at the beginning of the peak hours, around 8 or 9 PM. Most people are online around this time, so the picture will gain maximum exposure.
My friend argued that the best route was to post early in the day, around 9 or 10 AM. Although fewer people are online, many fewer images are posted, so any post will be viewed and therefore liked by more people.
It’s easy to convince yourself that either of these viewpoints is valid. However, since Instagram rolled out their algorithmic feed a year ago, it’s more difficult to see which (if either) of these viewpoints will be valid. In fact, the purpose of the switch from chronological order was to reduce this correlation between the time of day of a post and its exposure.
The specifics of the algorithm Instagram uses to populate its feed are undisclosed and unclear. The basic idea is that post quality will drive the post upward in the News Feed as long as it is still relevant to people. So as people react (by liking or commenting) to media they view, it will stay near the top of the feed. This strategy means that posts are ordered by some function of relevance and recency.
To determine the best time to post to maximize likes, I turned to the data. I wanted to download a lot of data from Instagram and sift through it to determine the post time that causes images to get the most likes.
Getting the Data
Instagram has a public API that developers can use to fetch certain data from Instagram. However, there is a very complicated authentication process required to make any request. Plus, the API hasn’t been updated in over a year. As such, I opted to use a private API. This library allows unlimited access to all of the resources you see when using the app, and all you have to do is provide a username and password. This is technically against Instagram’s terms of service. (Sorry, Instagram, but you left me no choice! I spaced out each of my requests to the API by a few seconds so that I wasn’t requesting resources any faster than a regular Instagram user might.)
To answer this question, I chose to analyze the posts of each person I follow on Instagram. This also allowed me to analyze data directly relevant to my social sphere.
(Note: Instagram didn’t allow me to differentiate between users by time zone. This data set would be more illuminating if it only included likes from people who are also on Eastern time.)
My process for downloading all of this data looked something like this:
- Log into the API and gain access to resources on Instagram.
- Download a list of everyone that I follow and save their User IDs along with the number of followers that they have.
- Filter out people with fewer than 20 or over 1,000 followers. (This eliminates people who don’t use Instagram much and accounts like @natgeo which would skew my data set).
- For each remaining user, download a list of all of the media that they’ve ever posted.
- Create a new object for each media item containing the number of likes, the date and time of the post, and the number of followers that the poster had. I also downloaded the caption.
- Save all of these objects to disk (I chose CSV format for ease of access).
- Filter out pictures posted from before the day Instagram finished phasing out the sequential posting strategy (June 7th, 2016). Process.
I wrote a Python script to perform these operations and save all 80,000 data points to a CSV file. Since I did all of the math before exporting the data, I could easily analyze the file using data visualization software. I chose Tableau to visualize the exported data. All of my code is available in a repository on Github. Download the code and run it to generate the same data for your own followers.
The Importance of a Caption
Once I’d obtained the data, I looked for an easy question to answer. There are many ways to analyze a set of the data from 80,000 images. I chose to look at the captions. But without using some fancy natural language processing tools, it’s hard to determine anything interesting. Here’s a visualization of the difference in likes between images with and without captions:
Median Number of Likes for Media With and Without Captions
Out of 77,268 data points, 3,278 (4.24%) of them did not have captions. The median like count overall for all images was 78. Captioned pictures, however, had a median like count of 81 (slightly higher). More surprisingly, pictures without captions had a median of 28 likes! This shows a significant difference in users’ reactions to pictures with captions than pictures without them.
Making Sense of the Data
The first step to analyze this data would be to verify our original assumption. Is there really a “peak time” where most followers are on Instagram? I computed the number of posts during each hour of the day to see for myself.
Median Number of Posts by Time of Day
Clearly, there is a correlation. The number of posts gradually increases from the morning until the peak time, between 9 and 10 pm, at which point the number of posts decreases again until between 4 and 5 AM, which is the least popular time for those I follow to post media on Instagram. This is a pretty good indicator that our original assumption is valid: most people are on Instagram in the evenings, specifically around 9 PM.
Again, trends would be more clear if Instagram still had a chronological feed instead of an algorithmic one. But hopefully some patterns should still emerge. To decide which is the best time of day to post at, let’s look at the typical like count across hours of the day.
Median Number of Likes by Time of Day
Remember that the median number of likes throughout the entire data set is 78. Between the hours of 9 and 10 PM, however, that figure rises to 90. On the other hand, posts made between 6 and 7 AM have a median of 42 likes. If we assume that the number of likes correlates with the number of views of a given post then we can state that posts get the most views during “peak hours” in the evening, especially around 9 PM. Adjust the time interval and you will see the same trend.
The data are somewhat normally distributed close to 9:20 PM. According to our first finding, this is also right about the time when most people are posting on Instagram, and probably when the most users are online. This shows that, although Instagram no longer displays posts in order of creation, the time of day posted still influences a post’s exposure.
Thus, theory 1 seems to be correct: to maximize the number of likes on an Instagram post, one should post in the evening, when most people are online.