Real Time Social Stats using Simple Javascripting

 

Social media is a powerful platform in which to engage your customers, understanding who are key influencers within your list of contacts and accounts is a cornerstone of every social engagement strategy. Channels such as Twitter, YouTube, LinkedIn are emerging as disrupters in the traditional marketing space. In short, this information needs to be in real-time so that you can respond very quickly to changes in the social media sphere. In this blog, I will be demonstrating how you can quickly enable your Microsoft Dynamics 365 system to display real-time subscriber data from your accounts’ and contacts’ social channels.

The demonstration and code I will describe here is very simple to implement with basic form design and JavaScript know-how. It can be tailored and extended to channels other than YouTube as is shown in this demonstration. I am using SocialBlade as our data source, but there a number of others freely available on the net.

So here are the steps to enabling real-time social data within Dynamics.

  • First, goto Settings>Customisations>Customize my System.
  • Navigate to the Contact Entity.
  • Navigate to Attributes.
  • Create a new Attribute called “Youtube Username”
  • Save and Close
  • Navigate to Contact Entity > Forms this time.
  • Create a brand new Main form called: “Social Blade” with the following properties
  • First Tab (Social Profiles)
    • Attributes: Full Name, and Youtube Username
  • Second Tab (Social Blade)
    • Add an Iframe (IFRAME_ socialbladewindow)

  • Save and Close.
  • Next Navigate to Web Resources.
  • Create a new Web Resource of type Javascript. Enter the following code within the Editor window:
function fncSocialBladeOnLoad()

{

// URL segment

var sbURLstart = "https://socialblade.com/youtube/user/";

var sbURLend = "/realtime";

var targetURL = "";

//Get the default URL for the IFRAME, which includes the

// query string parameters

var IFrame = Xrm.Page.ui.controls.get("IFRAME_socialbladewindow");

// get Social Media usernames/channelnames

var YouTubeUsername = Xrm.Page.getAttribute("sms_youtubeusername").getValue();

if (YouTubeUsername != ""){

//Append the parameters to the new page URL

targetURL = sbURLstart + YouTubeUsername + sbURLend;

// Use the setSrc method so that the IFRAME uses the

IFrame.setSrc(targetURL);

}else{

IFrame.setSrc("about:blank");

}

}
  • Open the previously created form. Click on Form Properties.
  • Add the newly created Javascript to Form Libraries.

  • Add an Event Handler and set this to the javascript library, with Function fncSocialBladeOnLoad.
  • Then publish your customisations.

That’s it. If you want to see a video demonstration of the solution, please visit my YouTube channel here: https://youtu.be/HL0ZsYcSTNo

I do hope this gets you thinking about different ways in which we can monitor social engagement across social media channels. There are plenty of opportunities to tap into our key influencers, and this is a great no-cost way of doing so. Of course, when you’re ready to put both feet in when it comes to Social monitoring and engagement, check out Microsoft’s own Microsoft Social Engagement suite.