Get a users followed sites using JSOM in SP2013 or SharePoint Online

SP.SOD.executeOrDelayUntilScriptLoaded(loadUserData, ‘SP.UserProfiles.js’);

function loadUserData()

{

var clientContext = SP.ClientContext.get_current();

 

var followingManager;

var followed;

 

 

followingManager = new SP.Social.SocialFollowingManager(clientContext);

 

 

Next we need to get the sites followed by the current user. For this we need to pass the actor ID of 4. For a list of all actor Ids see this.

 

followed = followingManager.getFollowed(4);

clientContext.executeQueryAsync(showFollowed, requestFailed);

​

}
​

function showFollowed() {

for (var i = 0; i < followed.length; i++) {

//get whatever you need from the followed array

}

​}

 

function requestFailed(sender, args) {

$(‘#message’).html(‘Error: ‘ + args.get_message());

}