Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Current »

Applying Facets

To ensure the correct timing when making alterations handle the send2crmLoading event in your own script:

window.addEventListener('send2crmLoading', (evt) => {
	// Facet evaluation code goes here.
});

Set a Facet for the Goal threshold

Facets may be applied when the visitor reaches a threshold value for a particular Goal.

// Apply the Personalization facet 'VIP_VISITOR' when the 'IMPORTANT_GOAL' Goal value reaches 50 total for the Visitor.
send2crm.personalization.setFacetForGoal('VIP_VISITOR', 'IMPORTANT_GOAL', 50);

The Facet will be applied automatically when the specified Goal reaches the given value.

Set a Facet using Custom Logic

Facets may also be applied using your own logic. This uses a callback function that provides the current Visitor object.

// Apply the Personalization facet 'REPEAT_VISITOR' when the Visitor has more than one Session.
send2crm.personalization.setFacetWhen('REPEAT_VISITOR', function(visitor) {
  return (visitor.sessionCount > 1);
});

See Visitor information for a list of available Visitor properties. The session property contains the current Session object. Use this data to perform your logic and return true if the Facet should be applied.

Retrieving Facets

Use the values of saved Facets to determine when you want to apply personalization to your website.

Testing

To check whether a visitor has a Facet applied, call the Send2CRM library function:

if (send2crm.personalization.hasFacet('VIP_VISITOR')) {
  // Do something special.
}

Persistence

Facets are recorded against the visitor, and never removed once applied. They are also sent to the Send2CRM service for Identified Visitors and synchronized across different browsers.

Facet Cookie

If the personalizationCookie setting is enabled, Send2CRM will automatically populate a cookie named send2crm with the values of all Facets separated by pipe (|) characters. e.g.:

|REPEAT_VISITOR|VIP_VISITOR|

This allows accessing the values of applied Facets server-side on your website.

Standard requirements for user acceptance of cookies apply. You may need to implement a suitable notice on your website if not already in place.

  • No labels