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.
Verify SDK installation
Section titled “Verify SDK installation”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.
How experiences load
Section titled “How experiences load”The SDK delivers experiences in two stages depending on how they are configured:
| Stage | When it fires | What it delivers |
|---|---|---|
| Pre-targeting | Immediately when the SDK loads | Experiences where all targeting resolves client-side. These are bundled directly in the SDK and appear instantly |
| Post-targeting | Seconds after page load | Experiences 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.
URL resolution
Section titled “URL resolution”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.
Single Page Applications (SPAs)
Section titled “Single Page Applications (SPAs)”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.
Going deeper
Section titled “Going deeper”- Experience Manager Overview: The four-tab editor walkthrough.
- Delivery & Scheduling
- Triggers
- Targeting
- A/B Testing
- Blueprints
- Inline: DOM injection, CSS selector placement, and visual element selector.
- Popups: Modal vs contextual modes, position, triggers, and orchestration.
- Flowcards: Isolated AMP rendering, snap points, card icons, and browser history integration.
- Tag Experiences: SDK configuration for tracking, integrations, and third-party tools.
- Recommender: Configure recommendation engines and layouts.
- Page Transformations
- Testing and Troubleshooting: Preview, live test, and debug your experiences.
- Web Activation: How the SDK delivers experiences on your site.
- AMP Activation: Run Flowcards on AMP pages.
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.