Instagram Tutorial

LAST EDIT Jul 22 2024

Tutorial: Instagram Style Personalization


This tutorial will explain how to build Instagram style personalization using Stream. The underlying tech is similar to that of a Pinterest style feed, Etsy’s e-commerce recommendations, email digests (such as Quora) or YouTube’s content suggestions.

The goal of this tutorial is to build a feed similar to Instagram's 'Explore' feed. The content is based on what type of images you've engaged with in the past as well as graph analysis. For example, if you often click on snowboarding pictures it will learn that you like snowboarding and display related posts.

Step 1: Test Data


Let's get started. As a first step we'll want to insert test data.

If you run the above snippet you'll insert 3 activities with the following images and tags:

#tree #snow #winter #landscape
#beach #van #surfing #travel
#dog #puppy #running #labrador

Step 2: Analytics


For this tutorial we will only track clicks. If you're building a production application, you'll want to track any type of event that signals a user's interest. The example below shows how to perform the analytics tracking if a user clicks on the second image. Analytics tracking is normally done client-side, and in this case we are using the JS analytics client.

The example above uses a score of 15. The score is a number between 0 and 100 and indicates the importance of an event. A click is typically less important than a like or a share, so give those events a higher score.

Step 3: Understanding Features


Those clicks give us a hint that the user is interested in that activity. There are many features attached to a given activity. For this example, we'll take a look at the features attached to the 2nd activity:

Once you've ran the code, ask yourself why the user is interested in this picture. Is it because the picture is about surfing? Or perhaps it indicates that he/she likes the post since it's created by a friend. One click doesn't give us significant data, but as the user keeps returning to your app, an interest profile starts to form.

Step 4: Follows


Personalization works best if you combine explicit follow relationships with analytics events. The example below shows how to create a follow relationship.

Step 5: Reading the Personalized Feed


With both follows and analytics in place, we now have the ability to read the personalized feed.

Step 6: Follow Suggestions


With the follow relationships in place, we have enough data to create follow suggestions.

This tutorial explained a simplified version of personalization for your app.

These algorithms need to be customized for each enterprise customer. Contact our data science team to learn how personalization can enhance your app.