Ok, so after discussing in my last blog about Data visualisation with the Twitter API, I thought I would take it further and make a more practical solution with the data we collect from Twitter.

It is cool to do something graphical with the data, but that is a very niche, so how about making a sidebar which organises products based on popularity on social media. When I say popularity, I mean, what are people tweeting about?

This time I am not using the Twitter Stream API, instead I will be utilising the Standard Search API. The reason for this is because I want to be relatively flexible in how far back in time I search for tweets, rather than what is being tweeted in real-time. The standard search is fast anyway – it will pick up any tweets using your chosen hashtags within a minute and can search up to 30 days worth of tweets. However, I will be adding a parameter to request recent tweets, meaning tweets from the day of the request. We can filter this data further which I will go into shortly.

So an overview of the plan is as follows:

  • Get a stream of data based on our specified hashtags from Twitter using the standard stream API.
  • Store the results in a MySQL DB, however, if the DB already has tweets; remove tweets older than x hours.
  • Query the DB using the count query to see how many times our keywords are mentioned in the DB.
  • Organise the count keyword results from high to low E.G We search how many times the word ‘Twilight’ is mentioned and hypothetically, we return the integer value 10 (which is the highest value out of all our queries), so ‘Twilight’ will be at the top of our list of results.
  • Present our products in order of their mentions on our website.

The GIF below shows me highlighting Twilight which had 7 people talking about it within a 3 hour time window (to be honest, I cannot be sure that it is Lush’s products that #Twilight refers to, as I would have to further modify my queries which is beyond the scope of this mini-project. Funny story, I searched through my DB tweets after using the hashtag #Lush and found a tweet that said; “Come watch me cream on cam #Lush“… Yeah, the data definitely needs to be sanitised!!). Anyway, back to the GIF! I then highlight Think Pink as this has the second most queries, thus the order of Twilight showing first, followed by Think Pink.

Ultimately, the cool thing about this is that the order of these bath bombs are self-organising which has been the goal of the project!

Embedding video capabilities into the page was simple enough, as well as embedding links into the videos themselves.

This has been a fun side project which I was inspired to start due to Lush’s recent decision to come off social media. Therefore, I have started to come up with ideas on how to replace the current social section in the sidebar of the Lush website.

Hope you enjoyed this little blog! I am off to London from 26-28th April for a tech recruitment fair (with Lush of course). In my next blog I will detail the day and give some insight as to peoples impressions of Lush as a tech focused business.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.