Track, identify and personalize visitors by company

Track, identify and personalize visitors by company

In a B2B scenarios, it is very important to identify the visitors to your website, allowing you to market to that user and track/guide their user journey. There are many ways to do this, including (but certainly not limited to) email campaigns, cookie tracking, traditional marketing campaigns, and IP tracking.

IP tracking has been around for a long time, with the data becoming more and more accurate over the years. In Sitecore, Geo IP tracking is built in, with its own GeoIP location service that can be purchased for a monthly consumption-based fee from Sitecore. But companies like Kickfire and Maxmind offer a deeper look into what is on the other end of that connection, identifying the company that is connected to the visitor's IP or the IP subnet.

To help with this, we have the Kickfire Analytics Module we have been using for a while internally, to personalize the user's experience based on the identifiable information about the user, gathered from their IP.

Identifying B2B Companies

Using the Kickfire API and the wonderful extensibility for Sitecore, we have created a Sitecore package that will add Company tracking to Sitecore's analytics (xDB) and surface it through the Sitecore Experience Analytics pages.

When a user visits the site, on the initial page load, the IP will be passed to the Kickfire API, returning all the information that they have about that IP.

{
    "status": "success",
    "result": 1,
    "data": [
        {
            "CID": 5031459,
            "name": "Kickfire",
            "website": "kickfire.com",
            "street": "2290 North 1st Street, Suite 102",
            "city": "San Jose",
            "regionShort": "CA",
            "region": "California",
            "postal": "95131",
            "countryShort": "US",
            "country": "United States",
            "phone": "408-725-9370",
            "employees": "10 to 50",
            "revenue": "$10,000,000 to $50,000,000",
            "category": "Information Retrieval Services",
            "sicCode": "7375",
            "category2": "Wired Telecommunications Carriers",
            "naicsCode": "517110",
            "latitude": "37.378862",
            "longitude": "-121.921275",
            "stockSymbol": "TER45",
            "facebook": "kickfireAPI",
            "twitter": "kickfire",
            "linkedIn": "kickfire",
            "linkedInID": "342956",
            "confidence": 99,
            "isISP": 0
        }
    ]
}```

After being identified, the Kickfire Company information is parsed into xDB facets and added to the contact's current tracker. Each time the contact comes from a different company, the new company is added to the contact's company history, so we can see all the companies the user has visited from. 

Now when a marketer visits the Sitecore Experience Analytics, in the list of visits to the site, a Company column has been added to the website.

![Experience Analytics](/content/images/2017/06/ExperienceAnalytics-1.png)

You can click on the company's name, and see all other visits from other contacts that have been associated to the same company. This will allow you to analyze the interaction and engagement value. 

Clicking into the visit, you will notice a **Company** tab has been added to the contact's details. This tab will show the last company that was identified to the user, and all the companies that were identified in the past for this contact.

![Kickfire Analytics](/content/images/2017/06/CompanyTab.png)

Additionally, the contact search has been overridden to allow the searching by contact name, email address, or also the company name. This will allow you to see all past visits from a given company. 

![Search](/content/images/2017/06/Search-1.png)

## Company Personalization 
If you wanted to target content based on a certain company being on the website. Or for fun to hide information from your competitors. You can personalize on the company names.

We have added a custom conditional rendering rule that allows you to specify the company you are targeting or not targeting. The rule allows for all string comparisons like equals, contains, begins with, etc...

![Company Name Rule](/content/images/2017/06/Name-Rule.png)


## Industry Personalization
With the information that is returned from the Api call,  the SicCode of the company's industry is included. Using a local SQL table, this SicCode is queried to get the defined industry name for the SicCode. It's important for this to be local, because this allows each installation to to be tailored specifically to the client's needs. 

When the IP is identified as a valid company, the SicCode is compared against a local SQL DB, returning a specific industry. With this industry, the KickFire module places the current session into the appropriate pattern card for the industry. You can see this with the [Profile Viewer](https://github.com/buildabonfire/Bonfire.Analytics.Dto) included with the installation. With this Api, you can see all the analytic details for the current user's session. In the image below, the Industry Profile (included with the module) has the pattern of Wholesale defined. This is because the SicCode that was provided for company look up was Wholesale. This causes the wholesale pattern card to be activated for the user, for the duration of this session. 

![Profile viewer](/content/images/2017/06/Pattern.png)

With this association, you can now easily personalize the user's content based on the industry pattern card they are in. Want to personalize content centered on companies that are in the Education? Just add a personalization for a user who's pattern card is **Educational Services** in the **Industry** profile card (both added as part of the module installation). Now, any company who is identified as any SicCode within the spectrum of Educational Services, will get your personalized content.

![Personalization](/content/images/2017/06/PatternPersonalization.png)

To override a SicCode, it is as simple as adding an override in the module section of Sitecore. Add the SicCode, pick the industry you want to associate with, and save. Now, any follow-on SicCode lookup will use your new association.

![SicCode Change](/content/images/2017/06/SicCode.png)

With this module, we want to be able to give insight to the marketer not just about the users, but the companies that are visiting the website. This will empower them to personalize the content, to better guide the companies through the appropriate user journey to conversion. The code is available at https://github.com/buildabonfire/Bonfire-Company-Personalization

## Prerequisite
This code requires Sitecore 8.2 and above. It uses Sitecore's Microsoft Dependency Injection. To use with pre-8.2 you must rebuild the code with your personal favorite DI (Simple Injector, Autofac, etc... )

## Installation Video
<iframe src="https://player.vimeo.com/video/222762570" width="640" height="400" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<p><a href="https://vimeo.com/222762570">Kickfire</a> from <a href="https://vimeo.com/user65403329">James Williamson</a> on <a href="https://vimeo.com">Vimeo</a>.</p>