Written by The Jahia Team
 
Developers
Sysadmins
   Estimated reading time:

jExperience and remote publication

jExperience is fully compatible with a remote publishing architecture. Though a precise method must be applied. Here are the steps:

  1. Start ElasticSearch.
  2. Start jCustomer.
  3. Start Jahia (ensure that contribution server operating mode is defined as "production" and remote server operating mode is defined as "distantPublicationServer", using jahia.properties).
  4. On the contribution server:
    Note: The remote site must have the same name/sitekey as original site, as all goals/conditions are based on node paths. Different site names are not supported for now.
    1. Create the desired site (for example, ACME SPORT).
    2. Install and enable the jExperience-modules.
    3. Configure jExperience in Site Settings.
  5. On the remote server:
    1. Create a new site with the same template set and same name/sitekey.
    2. Install jExperience-modules.
  6. Then set up the remote publication on the contribution node and execute the remote publication (check logs and UI, details about remote publication setup can be found here).
    1. Open the remote site in a new private window and browse the page.
    2. On the contribution server, check that the corresponding visitor profile was added in jExperience > Global > Audience > Profiles

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="org.jahia.services.uicomponents.bean.toolbar.Item">
        <property name="actionItem">
            <bean class="org.jahia.ajax.gwt.client.widget.toolbar.action.ExecuteActionItem">
                <property name="action" value="personalize"/>
                <property name="forbiddenNodeTypes" >
                    <set>
                        <value>wemnt:personalizedContent</value>
                        <value>wemnt:optimizationTest</value>
                        <value>wemmix:editItem</value>
                        <value>jnt:contentList</value>
                    </set>
                </property>
                <property name="requiredNodeTypes" value="jmix:droppableContent"/>
            </bean>
        </property>
        <property name="titleKey" value="label.edit.personalize@resources.marketing-factory-core"/>
        <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="org.jahia.services.uicomponents.bean.Visibility">
                <property name="permission" value="canPersonalizeWithMarketingFactory"/>
            </bean>
        </property>
    </bean>

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.

Deploy a jCustomer patch from a Jahia module

jCustomer provides a system to deploy patches to perform precise modifications to existing definition objects, such as properties and conditions. You can find the documentation for the patches system in the Apache Unomi documentation.

You can deploy patches from a Jahia module. To do this, ensure you place the patches in the META-INF/marketing-factory/patches directory.