Liking, commenting, tagging, bookmarking or defining something as favorite are all common on-line activities these days. However, most of us don't realize the depth of information we leave behind each time we perform them and what we can actually do with that information.
This is perfectly understandable in a world that hides all those details behind APIs that regular people can't use. Fortunately, this is no longer the case anymore. Today I would like to show you how to leverage the Social Media Scripting Framework to extract meaningful information from those that connect with you or your brand in LinkedIn.
Let's start by getting data from our LinkedIn Timelines …
$LINPosts = Get-LINTimeLine -results 100 -quick
Now, let's have a look at what we've got in return:
# Distribution by SubChannel (Real Names have been masked for privacy reasons) $LINPosts.NormalizedPost | group SubChannelName | select Name, Count | sort count -Descending | ft -AutoSize Name Count ---- ----- XXXXXXXXXXXXXXXXXX 50 XXXXXXXXX (Company) 33
As you can see, we have posts from one LinkedIn Group and from a LinkedIn Company Page. You many also have noticed that we requested 100 posts and we were given just 83 … Sorry guys, welcome to the world of the LinkedIn API … In future posts I will show you how to get this around ;-).
Let's have a look to the interactions that have taken place on these posts:
# All interactions collected $LINPosts.PostConnections.Count # 1573 # All unique people that have interacted with this brand $LINPosts.PostConnections | select UserDisplayName, UserDescription -unique | measure # 987
Simple, isn't it? Notice that there are a number of people that consistently interact with that brand.
Now, let's see if we can identify VIPs from that list of connections. For that we will use a Regular Expression to spot which ones claim to work as CxOs, VP, etc.:
# All unique potential VIPs $LINPosts.PostConnections | where UserDescription -Match "[ /S]VP[ /]|[ /]CIO[ /]|[ /]CTO[ /]|CEO|[ /]CMO[ /]|[ /]COO[ /]|director|head|chairman|principal|fellow|owner|founder|cofounder|co-founder|President|vice president|deputy|mgmt|Sr|Exec|Entrepreneur|Strategist|Strategy|Fundador" | measure # 315
Not bad, 315 VIPs out of 1573 … But we can do better. Let's try to reduce “noise” even further. To do that, let's try the following:
$LINPosts.PostConnections | where { ( $_.UserDescription -Match "[ /S]VP[ /]|[ /]CIO[ /]|[ /]CTO[ /]|CEO|[ /]CMO[ /]|[ /]COO[ /]|director|head|chairman|principal|fellow|owner|founder|cofounder|co-founder|President|vice president|deputy|mgmt|Sr|Exec|Entrepreneur|Strategist|Strategy|Fundador" ) -and ` !( $_.UserDescription -Match "ReplaceWithYourCompanyName|ReplaceWithYourBrandName|certified|manager|ITIL|PMP|CCN|CCD|Account|Project|Factory|developer|engineer|MBA|negocios|funcional|sales|Consultant|Assistant" ) -and ` !( $_.UserDisplayName -Match "PersonToExclude1|PersonToExclude2|PersonToExclude3|..." ) } ` | select UserDisplayName, UserDescription -unique ` | measure # 87
Much better! Now, 83 out of 1573! If you read carefully the above statement this is what we are doing:
- We select those people that “claim” to have a significant job or role (CxOs, etc.) with a Regular Expression.
- We exclude insiders (those who belong to the company or brand we are analyzing) and other terms and roles that can introduce noise in our selection.
- We exclude specific names of people that we know are insiders but, for some reason still show up after applying our previous filters.
- We create a unique list of those names.
- And, finally, count them.
That's fine, but I would like to know who they are, not just count them. Ok, that's easy:
$LINPosts.PostConnections | where { ( $_.UserDescription -Match "[ /S]VP[ /]|[ /]CIO[ /]|[ /]CTO[ /]|CEO|[ /]CMO[ /]|[ /]COO[ /]|director|head|chairman|principal|fellow|owner|founder|cofounder|co-founder|President|vice president|deputy|mgmt|Sr|Exec|Entrepreneur|Strategist|Strategy|Fundador" ) -and ` !( $_.UserDescription -Match "ReplaceWithYourCompanyName|ReplaceWithYourBrandName|certified|manager|ITIL|PMP|CCN|CCD|Account|Project|Factory|developer|engineer|MBA|negocios|funcional|sales|Consultant|Assistant" ) -and ` !( $_.UserDisplayName -Match "PersonToExclude1|PersonToExclude2|PersonToExclude3|..." ) } ` | select UserDisplayName, UserDescription -unique ` | format-table -autoSize
Notice that this is just the same sentence we run before. The only difference lays on the last sentence: now, instead of Measure
, we are issuing a Format-Table
command … So, similarly, if we were interested on exporting that list to Excel, we should use the Export-Csv
as our last step:
$LINPosts.PostConnections | where { ( $_.UserDescription -Match "[ /S]VP[ /]|[ /]CIO[ /]|[ /]CTO[ /]|CEO|[ /]CMO[ /]|[ /]COO[ /]|director|head|chairman|principal|fellow|owner|founder|cofounder|co-founder|President|vice president|deputy|mgmt|Sr|Exec|Entrepreneur|Strategist|Strategy|Fundador" ) -and ` !( $_.UserDescription -Match "ReplaceWithYourCompanyName|ReplaceWithYourBrandName|certified|manager|ITIL|PMP|CCN|CCD|Account|Project|Factory|developer|engineer|MBA|negocios|funcional|sales|Consultant|Assistant" ) -and ` !( $_.UserDisplayName -Match "PersonToExclude1|PersonToExclude2|PersonToExclude3|..." ) } ` | select UserDisplayName, UserDescription -unique ` | Export-Csv .\LinkedIn-EngagedVips-201403-0.csv
Well, we've got it! But, wait a second, wouldn't it be nice if we were able to identify those posts where these VIPs were engaging? That would actually “close the circle” and give us a a view of the complete picture including the content … Ok, let's try the following:
$LINPosts | where { ( $_.PostConnections.UserDescription -Match "[ /S]VP[ /]|[ /]CIO[ /]|[ /]CTO[ /]|CEO|[ /]CMO[ /]|[ /]COO[ /]|director|head|chairman|principal|fellow|owner|founder|cofounder|co-founder|President|vice president|deputy|mgmt|Sr|Exec|Entrepreneur|Strategist|Strategy|Fundador" ) } ` | select @{ Name='Title'; Expression={ $_.NormalizedPost.Title } } -unique ` | measure # 48 posts selected
The main difference on this query is that we are focusing on $LINPosts
rather than on $LINPosts.PostConnections
as our data source. Why? Because, now, we want to select content rather than people. Anyway, you may have noticed that the structure of the query is pretty similar to the previous ones:
- We take a collection of objects as a data source.
- We apply a number of filters.
- We select the properties we need.
- We define how do we want the data to look like on the output.
Anyway, we have now 48 posts selected and if we want to view them or take them into a Excel sheet, we should proceed as we did before:
$LINPosts | where { ( $_.PostConnections.UserDescription -Match "[ /S]VP[ /]|[ /]CIO[ /]|[ /]CTO[ /]|CEO|[ /]CMO[ /]|[ /]COO[ /]|director|head|chairman|principal|fellow|owner|founder|cofounder|co-founder|President|vice president|deputy|mgmt|Sr|Exec|Entrepreneur|Strategist|Strategy|Fundador" ) } ` | select @{ Name='Title'; Expression={ $_.NormalizedPost.Title } } -unique ` | format-table -autoSize $LINPosts | where { ( $_.PostConnections.UserDescription -Match "[ /S]VP[ /]|[ /]CIO[ /]|[ /]CTO[ /]|CEO|[ /]CMO[ /]|[ /]COO[ /]|director|head|chairman|principal|fellow|owner|founder|cofounder|co-founder|President|vice president|deputy|mgmt|Sr|Exec|Entrepreneur|Strategist|Strategy|Fundador" ) } ` | select @{ Name='Title'; Expression={ $_.NormalizedPost.Title } } -unique ` | Export-Csv .\LinkedIn-EngagedVips-content-201403-0.csv
Oh, wait! Can we do the same thing in Twitter?
Of course ;-). Just replace your LinkedIn timeline, $LINPosts
in our case, with one coming from Twitter; $TwPosts
for example. And that's it! :D. In fact, it's even better. You can have a Timeline with posts coming from multiple Social Media channels and apply the above queries to that dataset! Therefore, if you build a $FullTimeline
based on contents from $LINPosts
and $TwPosts
, you can use that as your data source.
# Building a Timeline with posts comming from more than one Social Channel $FullTimeline = $LINPosts + $TwPosts
Just as a reminder, here is how you build Twitter timelines … As you can see, it's almost the same as the LinkedIn case:
# Acquiring a timeline from http://twitter.com/cveira ... $TwPosts = Get-TwTimeLine -name cveira -results 100
The Future: Scoring Systems
The methods and techniques discussed here are just the beginning. Future versions of the framework will be able to provide information coming from different on-line reputation scoring systems like Klout, PeerIndex, Kred and TrustCloud. You will also be able to define your own score metric if you will. That way, your capabilities for identifying influencers will be significantly expanded. Unfortunately, although we have defined the foundations to do it, we are not there yet. But, stay tuned! 😀
Conclusion
As you can see, now it is pretty straightforward to perform this sort of queries against a Social Media Timeline to get insights that, otherwise, wouldn't be possible or at least, very hard or expensive to achieve.
Additionally, the operational pattern followed to get this information is consistent and reusable which makes it ready for something we are very familiar with: the “copy & paste”. That way, those of you that may not feel prepared for an environment as intimidating as a CLI, now, hopefully, can confront it with a little bit of more confidence.
Anyway, I know that there is always room for improvement. What is your point of view about this?
Picture: “Magic Mirror Eye” by Steve Jurvetson. Licensed under CC-BY-20.