coreyasmith / sitecore-experience-profile-gravatar

🎭 Use Gravatar for contacts in the @Sitecore Experience Profile.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🎭 Gravatars in Sitecore Experience Profile

This repository contains code for displaying Gravatars in the Sitecore Experience Profile that Rick Bauer and I demonstrated in our JavaScript Services & Marketing Automation and Crank Up Your Sitecore Authoring and Marketing Experience presentations.

Contact in Experience Profile with robohash default image

βš™οΈ Implementation

There are two ways to integrate Gravatar with the Experience Profile:

  1. Override the IContactService that the Experience Profile uses to retrieve the contact's Gravatar on page load; and/or
  2. Write to the contact's Avatar facet at some point in their journey with your website (see the warning below!).

The first option will add Gravatar to all contacts in the Experience Profile as it does not require you to write to the Avatar facet of your contacts. The second option makes the contact's Gravatar available anywhere you use the Avatar facet in your site.

At a minimum I recommend implementing the first option in your Sitecore solutions. The second option is nice for new Sitecore installs, but probably not practical for existing solutions with lots of existing contacts. Both options are compatible with each other.

See the code in the Experience Profile feature module to see how you can integrate a GravatarService into the IContactService to load the Gravatar for all contacts in the Experience Profile that don't have the Avatar facet set.

See the code in the ContactRepository of the Website project module to see how to set the Avatar facet on contacts using Gravatar.

🚨 Avatar Facet Warning

There is a bug in the xConnect Index Worker in Sitecore 9.1 and above that causes it to fail and stop indexing any contacts if images above a certain size are written to the Avatar facet. New contacts will not show up in the Experience Profile until the offending Avatar facet is removed from the data store (e.g., SQL Server).

To fix this issue, set the StringFieldMaximumLength to a value that is divisible by 4 in the xConnect Indexer Worker's config as I've done in sc.Xdb.Collection.Search.IndexTruncation.xml and deploy it to your xConnect Index Worker in all environments.

No matter what precautions you take (e.g., downsizing images, compressing images), if you write to the Avatar facet in xConnect you are going to be affected by this issue. DO NOT write to the Avatar facet (using Gravatar or otherwise) in Sitecore 9.1 or above without applying this fix first.

πŸ—οΈ Setup

🐳 Docker

  1. Build the Sitecore 9.3 docker images using the steps in the Sitecore Docker images repository.
  2. Build the solution with the Docker build configuration.
  3. All projects in the solution will be automatically published to Docker on build courtesy of Helix Publishing Pipeline.
  4. On the command line:
    1. cd C:\[path-to]\sitecore-experience-profile-gravatar
    2. docker-compose up

πŸ’½ Locally

  1. Install a new instance of Sitecore 9.3.
  2. Update the publishUrl in PublishSettings.Sitecore.targets to your Sitecore installation's web root (e.g., C:\inetpub\wwwroot\sc93.sc).
  3. Update the publishUrl in PublishSettings.XConnectIndexer.targets to your Sitecore installation's xConnect Indexer Worker root (e.g., C:\inetpub\wwwroot\sc93.xconnect\App_Data\jobs\continuous\IndexWorker).
  4. Update the sourceFolder in CoreyAndRick.Project.Common.Dev.config to point to the root of this repository on your disk.
  5. Build the solution with the Debug build configuration.
  6. All projects in the solution will be automatically published to Sitecore on build courtesy of Helix Publishing Pipeline.

About

🎭 Use Gravatar for contacts in the @Sitecore Experience Profile.


Languages

Language:C# 88.2%Language:HTML 11.2%Language:PowerShell 0.6%