Lyubisha Aleksandrov
Lyubisha Aleksandrov

Reputation: 31

Sitecore gender personalization

I added personalization rule in my Sitecore site - "Where the gender of the current contact is Male", but I can't figure out how to set "Visitors settings" to test it.

I'll be very grateful if someone can help me with this.

Thanks in advance!

Upvotes: 0

Views: 279

Answers (1)

Martin Miles
Martin Miles

Reputation: 2096

The only Gender condition I found in default Sitecore 8 installation is the one coming from Social module (that is now built-in) located at /sitecore/system/Settings/Rules/Definitions/Macros/Social/Gender in Sitecore tree. Looking up its code I see the following code:

protected override bool Execute(T ruleContext)
{
  if (!AnalyticsSettings.Enabled || Tracker.Current == null || Tracker.Current.Contact == null)
    return false;
  return string.Equals(this.GenderValue, ((IGenderConditionManager) ResolutionExtensions.Get<IGenderConditionManager>((IResolutionRoot) ExecutingContext.Current.IoC, new IParameter[0])).GetGender(GuidExtensions.GetIdentifier(Tracker.Current.Contact.ContactId)).ToString(), StringComparison.OrdinalIgnoreCase);
}

From the code above we can see that to make Gender condition work, you should have analytics and tracking up and running. So if you have that enabled - ensure all settings are correct and it works indeed.

User membership provider does not have gender settings by itself; so the rule condition above can take it only from tracking.

Upvotes: 0

Related Questions