Adding Social Media Actions

Today we added more code to our setup (both Push API and web browser code) to catch whether or not the users are sharing articles on social media. We were already looking at whether or not they were clicking on links, but we wanted to grab this info if we could because of how valuable it is.

Our usual approach to observing user behavior on the web pages is to look for CSS classes that are unique to the HTML elements the users interact with. We can write JavaScript that sets event handlers on those elements so that messages get sent to our Push API when they interact with them. Luckily for us, the social media buttons do have those classes. But wait, there’s more!

The buttons are from a social media service called AddThis, who provide more functionality than just CSS classes. They’ve already designed an API with event handling, using the same unobtrusive JavaScript techniques we used for designing our client code. So we don’t even have to write our own event listeners targeting elements with CSS classes. We just tap into the events they’ve already prepared as part of Engineering.com using their API. For example, one of the events is called “addthis.menu.share” and it fires when the user uses the buttons placed on the page by AddThis to share the page (ex. to Reddit, Facebook, etc). That saves us some work and also makes our work more future-proof because we’re tapping into the way they design their system which likely won’t change. It’s official, it’s supported. It’s not just something two coop students at Seneca came up with as they learned how to build things.

We made the required changes but due to the complexity of the changes and my unfamiliarity with testing this kind of change, we decided to wait until Monday morning to test it, when we’ll have more time to observe it and correct any issues.

The rest of the day I also spent time preparing for my second presentation. I’ll be giving an introduction to Elasticsearch and how to use it an MVC style web app. My team mate will be giving an introduction to machine learning and how search engines like Elasticsearch rank results, using mathematical techniques like term frequency-inverse document frequency.

Oh yeah and I learned that Google Docs produces much nicer-looking presentations than LibreOffice Impress.

aws_deploy

So far so good with our scale up to being on all the article sections, by the way. Our database isn’t breaking a sweat:

Screenshot_20161202_221239.png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s