Introduction

In today’s days of social media involvment, digital marketing is incomplete without social presence of brands. In fact, brands spend a substantial amount of effort and budget designing their social presence and how that might lead to a higher user engagement and ultimately better sales. Therefore digital analysts do measure the success of social presence of a brand and compare its performance relative to its competitors.

There are various ways this can be done. Facebook for example provides data about user visits and actions on a page, and even more data on paid ads and through their Marketing API. This article shows how R can be used to extract data programmatically and derive conclusions out of that data.

For our analysis, we extract data from the MasterCard, Visa and American Express Singapore Facebook pages from January 2014 to May 2015. All data extracted is from the public domain only.

Getting the data

The Facebook Graph API can be used to scrape public data. R’s Rfacebook library lets us do the same from R conveniently.

We first need to obtain a temporary access token (manually) from https://developers.facebook.com/tools/explorer. Assume that it is stored in mytoken. We can then gather all posts in the following way:

library(Rfacebook)
mc <- getPage(page="MasterCardSG", token=mytoken, n=1000, since='2014/01/01', until='2015/05/31')
visa <- getPage(page="VisaSingapore", token=mytoken, n=1000, since='2014/01/01', until='2015/05/31')
amex <- getPage(page="AmericanExpressSingapore", token=mytoken, n=1000, since='2014/01/01', until='2015/05/31')

We extract the following columns from this data:

  1. from_name: Post is made by this name (e.g. “American Express”)
  2. created_time: Time of post.
  3. type: Type of post - photo, video, link or offer.
  4. likes_count: Number of likes to this post.
  5. comments_count: Number of comments to this post. 10.shares_count: Number of shares of this post.

We also get the whole body of the post but we are not processing it here.

index <- c(2,4,5,8,9,10)
data <- rbind(amex[,index], mc[,index], visa[,index])

A First Comparison of Visa, MasterCard and Amex Singapore

With our data set, we can easily compare the monthwise number of posts made by the three Facebook pages.

names(data)[1] <- "Page"
ggplot(data, aes(x=as.Date(created_time), fill=Page)) +
       geom_bar(color="black", position=position_jitterdodge()) +
       xlab("Date") + ylab("Number of posts")
Fig. 1: Number of Posts in Visa, MasterCard and Amex Singapore Facebook pages

Fig. 1: Number of Posts in Visa, MasterCard and Amex Singapore Facebook pages

This shows that American Express has made the maximum number of FB posts for most of the time, except for the summer of 2014, when Mastercard showed a higher activity.

We now try to see the relative number of different types of posts made. The R code is pretty straightforward and not shown hereafter,

Fig. 2: Relative Number of different types of posts

Fig. 2: Relative Number of different types of posts

All pages therefore put an overwhelming number of photo posts compared to the other types.

Engagement Comparison

We define engagement as the total number of likes, comments and shares. Let us try to compare the engagements of the three pages.

Fig. 3: Engagement Comparison

Fig. 3: Engagement Comparison

The engagement of the photo posts is the highest. However, this may also be due to the fact that the number of photo posts is high. To take care of this, we measure the engagement per post for the three pages.

Fig. 4: Comparison of Engagement per post

Fig. 4: Comparison of Engagement per post

The results are quite different now, though photos continue to be the most engaging. Offers are also good at engaging people. The engagement capability of video, status and links posts are about a third of photo posts.

Engagement Over time

Let us now see how the three pages have engaged people for each of the individual posts they made.

Fig. 5: Engagement over time

Fig. 5: Engagement over time

The figure reveals some interesting facts: a few MasterCard posts seemed to capture the imagination of a lot of people, but on the whole its response was the poorest Visa posts on the other hand, had a good response throughout.

To reveal the trends of the lesser engaging posts, we re-draw the above figure leaving out the top posts.

Fig. 6: Engagement over time, leaving out top posts

Fig. 6: Engagement over time, leaving out top posts

This stresses the fact general engagement was least for MasterCard. Visa a had good involvement in the first half of 2014, but that petered off later. Amex engagement on the other hand, started off poorly but picked up slowly.

Which are the most engaging posts?

Of the 6 top engaging posts, 4 are from Visa and 2 from MasterCard. Let us see what they are.

Engagement Page Post Link
473 13717 MasterCard Fall in love again with exclusive MasterCard cardholder benefits across Southeast Asia: www.mastercard.com/seagolf #pricelessgolf https://www.facebook.com/MasterCardSG/photos/a.388858531156239.81466.381777845197641/763835140325241/?type=1
808 12245 Visa Beach vacations should leave you with glowing tans and happy memories. Find the best resorts, experiences and deals with the Visa mobile app! https://www.facebook.com/VisaSingapore/photos/a.227407244050784.1073741828.225803677544474/283010975157077/?type=1
821 9863 Visa Visit Taiwan when the skies are ablaze with wishes and fulfill yours! Plan a trip with Visa for amazing offers and more. Download the Visa mobile app https://www.facebook.com/VisaSingapore/photos/a.227407244050784.1073741828.225803677544474/282575355200639/?type=1
734 9023 Visa Take your kids to Sentosa and see how fun learning can be when you’re in the great outdoors. Get 5% off tickets to Sentosa attractions with your Visa https://www.facebook.com/VisaSingapore/photos/a.227407244050784.1073741828.225803677544474/337654029692771/?type=1
402 8479 MasterCard Congratulations to … for your winning entries! We’re going to help you celebrate with an exclusive weekend getaway. We have more prizes to give away! Remember to check your story submission for our replies. https://www.facebook.com/MasterCardSG/photos/a.388858531156239.81466.381777845197641/822325237809564/?type=1
693 8241 Visa When was the last time you had a holiday? If you’re keen on a getaway, the long weekends coming up in 2015 could be your chance to escape. https://www.facebook.com/VisaSingapore/photos/a.227407244050784.1073741828.225803677544474/377888095669364/?type=1

These posts either contained an offer or a contest with prizes. All except the topmost post was related to travel; the topmost was about golf.

Conclusion

From the 17 months of data scraped, we see that American Express topped the number of posts made for a larger time duration, only to be second to MasterCard for a few months. The highest engagement numbers were recorded by a couple of posts by MasterCard. However, a higher ratio of posts by Visa engaged substantial number of people compared to the other pages. We can conclude that Visa engaged people more despite a lower number of posts.

By looking at the top posts we also found that offers related to travel and contests with prizes built the maximum engagement. That may be a good finding to credit card companies to design future social media campaigns!