Advanced Content Targeting using SharePoint Search - Perficient Blogs
Blog
  • Topics
  • Industries
  • Partners

Explore

Topics

Industries

Partners

Advanced Content Targeting using SharePoint Search

There are various ways to achieve content targeting in a content management system. In SharePoint, some common terms which are associated with this feature are Audience Targeting, Security Trimming, Metadata etc. Today I am going to share an example which we recently implemented for our customer and which required advanced targeting rules.

Scenario

An internal portal accessed by employees and contractors in three dozen locations comprising of countries and/or regions. Authoring takes place in a separate content site and content is rendered on a publishing site. All content is targeted with three important profile attributes –

a. Location (comprises of country and their region)

b. Role

c. Business Unit

Each piece of content or even a link takes user to the publishing site keeping authoring unexposed to the end user. What this means to search is

a. Customizing search results URL to point to publishing

b. Customizing hover preview to display publishing pages

c. And most importantly the results should be targeted based on user profile properties (mentioned above)

Solution

In order achieve the above, we designed a custom solution extending content by search web part. This solution inserts a query token into the content search web part which filters the indexed content with logged in user’s profile attributes (Location, Role, Business Unit). (Credit goes to my colleague Ryan Selley for developing this robust solution)

First we’ll map managed properties to crawled properties for the taxonomy terms used to tag content.

mp

Then we’ll create the custom web part in Visual Studio by extending content by search.

wp1

Then we’ll Generate a custom query variable to insert in the search query box.

wp2

Build this custom query token with logged in user’s profile properties in the BuildTAQuery()

wp4

This is how the query text looks in the search web part

wp5

With this token in place your content is now targeted on the user’s profile attributes. The logged in user will now only see content which has been tagged to their location, role, and business unit.

Happy targeted coding!

One thought on “Advanced Content Targeting using SharePoint Search

  1. Thanks Vaibhav for sharing this. Indeed, great solution in cross site publishing implementation.
    I have implemented the same functionality for one of my customers. Mine was in Office 365 and I could not extend the CSWP. I achieved this leveraging CSWP’s asynch rendering and custom display templates.
    Sachin

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to the Weekly Blog Digest:

Sign Up