Integrating with Jahia

October 19, 2022

Integrating with custom Jahia valves

If you have (or are planning to develop) custom Jahia valves, they will need to send a login event to jCustomer once the user is successfully authenticated. Failing to do that the Jahia user will not be properly associated with the jCustomer profile and features such as profiling merging will not work properly. All that is required is that a Spring Event is sent internally inside Jahia, jExperience already listens to this event to send a corresponding event to jCustomer. So make sure you include the following code to your valve to send the Spring Application Event :

final AuthValveContext authContext = (AuthValveContext) context;
SpringContextSingleton.getInstance().publishEvent(new LoginEvent(this, jahiaUser, authContext));

where the jahiaUser is the authenticated Jahia user and the context is the context object passed to the valve in the invoke method. 

Jahia components and jExperience

For a Jahia component to support personalization and optimization, it shall be a droppable content and shall not be a content list

In others words, "add personalization" and "add AB test" features are enforced by the definition below.

<bean id="Toolbar.Item.Personalize" class="">
        <property name="actionItem">
            <bean class="org.jahia.ajax.gwt.client.widget.toolbar.action.ExecuteActionItem">
                <property name="action" value="personalize"/>
                <property name="forbiddenNodeTypes" >
                <property name="requiredNodeTypes" value="jmix:droppableContent"/>
        <property name="titleKey" value=""/>
        <property name="icon" value="/modules/marketing-factory-core/images/icons/personalize"/>
        <property name="parent" value="editmode.contextMenu"/>
        <property name="requiredModule" value="marketing-factory-core"/>
        <property name="visibility">
            <bean class="">
                <property name="permission" value="canPersonalizeWithMarketingFactory"/>

When you will add a personalization or an AB test on the content from Jahia, the mixin "wemmix:parentContainer" will be automatically added to the parent content to authorize it to contains nodes of type "wemmix:wemComponents" which means that you would be able to add "wemnt:personalizedContent" and "wemnt:optimizationTest" on your content.