Skip to content
Login Contact

Experiences web activation via Marfeel SDK

Publish an experience in Experience Manager and it goes live on your site. No code changes required for standard web pages: the Marfeel SDK handles delivery automatically.

Experiences require the Marfeel SDK (marfeel-sdk) on your site. To confirm it is installed, open your browser’s developer console on any page and check for the window.marfeel object. For a full list of supported platforms and installation methods, see the SDKs overview.

If the SDK is not installed, contact your Marfeel account team or refer to the SDK installation documentation.

The SDK delivers experiences in two stages depending on how they are configured:

StageWhen it firesWhat it delivers
Pre-targetingImmediately when the SDK loadsExperiences where all targeting resolves client-side. These are bundled directly in the SDK and appear instantly
Post-targetingSeconds after page loadExperiences that use targeting dimensions requiring server evaluation (e.g., loyalty segment, geographic location). The SDK requests experience.mrf.io/json/experiences and delivers the result

You do not choose between these stages. The system determines the stage automatically based on the targeting dimensions you configure. If every dimension resolves client-side, the experience is pre-targeted. If any dimension requires server evaluation, it becomes post-targeted.

The SDK uses the page’s canonical URL (link rel="canonical" in the page head) to match experiences to the current page. All targeting and content rules evaluate against this URL.

If you previously tracked a manual page navigation using the trackNewPage() method, that URL takes precedence over the canonical URL.

Important: If experiences appear on the wrong page or do not appear at all, check your canonical URL first. A missing or incorrect rel=“canonical” tag is the most common cause. See testing and troubleshooting for additional diagnostic steps.

On standard browser navigations (full page loads), experiences reload automatically for each new page.

For Single Page Applications (SPAs) or Progressive Web Apps (PWAs) where navigation occurs without a full page refresh, you need to trigger experience reload manually after each route change:

window.marfeel.cmd.push(['experiences', (experiences) => {
experiences.triggerExperiences();
}]);

Call this after every SPA route transition. The SDK re-evaluates targeting and delivers experiences for the new page.

Important: Only use triggerExperiences() for dynamically loaded pages. Experiences on native browser navigations are loaded automatically. Calling it on a standard page load will result in duplicate experience delivery.

What is the difference between pre-targeting and post-targeting experiences?

Pre-targeting experiences are bundled directly in the SDK and appear instantly because all targeting resolves client-side. Post-targeting experiences require server-side evaluation of dimensions like loyalty segment or geographic location, so the SDK fetches them from experience.mrf.io/json/experiences seconds after page load. The system selects the stage automatically based on your targeting configuration.

How do I reload experiences in a Single Page Application?

Call triggerExperiences() after every SPA route transition. The SDK re-evaluates targeting and delivers experiences for the new page. Only use this method for dynamically loaded pages. On native browser navigations, experiences load automatically, and calling triggerExperiences() would produce duplicates.

Why do experiences appear on the wrong page or not appear at all?

The most common cause is a missing or incorrect rel="canonical" tag. The SDK uses the canonical URL to match experiences to the current page. If you previously tracked a manual page navigation using trackNewPage(), that URL takes precedence over the canonical. Check your canonical URL first, then review troubleshooting steps for other common causes.