For the complete documentation index, see llms.txt. This page is also available as Markdown.

Web Component integration

Activate or deactivate web components from the Magento 2 configuration page.

Web Component templates live in:

src/view/frontend/templates/ff

Module styles live in:

src/view/frontend/web/css/source/ff

The source stylesheet is:

src/view/frontend/web/css/source/_module.less

Integrate templates anywhere in your shop. Magento 2 layouts are the recommended approach. For example, this SDK integrates ff-suggest into the ff-searchbox template:

<referenceBlock name="top.search">
    <action method="setTemplate" ifconfig="factfinder/general/is_enabled">
        <argument name="template" xsi:type="string">Omikron_Factfinder::ff/searchbox.phtml</argument>
    </action>
    <block class="Magento\Framework\View\Element\Template" name="factfinder.suggest" as="suggest" ifconfig="factfinder/general/is_enabled" template="Omikron_Factfinder::ff/suggest.phtml" />
</referenceBlock>

You can also instantiate a block with the Magento Layout API. This is not the recommended approach:

<?php echo $this->getLayout()
->createBlock(\Magento\Framework\View\Element\Template::class)
->setTemplate('Omikron_Factfinder::ff/suggest.phtml')
->toHtml(); ?>

FACT-Finder Web Components uses Handlebars for HTML templates. See the Handlebars documentation.

Configuration element

The main Web Components configuration is in src/view/frontend/templates/ff/communication.phtml. Its view model is src/ViewModel/Communication.php. The template belongs to the default layout and is added to after.body.start.

This template is essential. Ensure your project includes it. Avoid overriding both the template and view model.

Searchbox integration and functions

Once you activate FACT-Finder Integration, the searchbox component automatically replaces the default Magento 2 search.

Its template is:

Searches redirect to the FACT-Finder search-results page. The module adds relevant data to its URL, including the FACT-Finder channel and query string. Its layout definition is:

That layout already integrates templates including ff-record-list.

Data transfer between the shop and FACT-Finder

Communication Overview

By default, search and suggest requests go directly to FACT-Finder. Enable Proxy only when you must modify request parameters or responses.

Using Proxy

Proxy passes each search request through this controller before returning it to the frontend:

Add an afterExecute plugin through Magento Interceptors to enrich FACT-Finder data. Proxy adds HTTP and Magento processing overhead. Avoid it without a clear requirement.

Using FACT-Finder on category pages

The module preserves category URLs and SEO by using Magento routing with custom search parameters. Category-page searches start immediately through searchImmediately. Enable the corresponding Main Settings option.

Set the CategoryPath field name

The SDK uses CategoryPath by default. Set the field name in the SDK configuration if your FACT-Finder category field differs.

Main Settings

Tracking

Web Components tracks these events:

  • Product clicks

  • Add-to-cart actions

  • Order purchases

  • User logins

For click tracking, use the data-redirect directive described in the tracking guide. Add-to-cart tracking uses src/view/frontend/web/js/catalog-add-to-cart-mixin.js. It requires the base catalog-add-to-cart.js.

Checkout tracking uses ff-checkout-tracking in src/view/frontend/templates/ff/checkout-tracking.phtml. This extends checkout_onepage_success. If your checkout uses another layout, append this template there. Use src/ViewModel/Order.php to provide the necessary backend data.

Login tracking calls factfinder.tracking.login from src/view/frontend/templates/ff/communication.phtml.

Last updated

Was this helpful?