Handling Require.js in Magento 1 (Only for Clerk v1)

Make sure that Clerk.js can be loaded when using Require.js

This guide only applies when using up to v.3.7.2 of the Magento 1 Clerk extension.

In some setups, Require.js stops Clerk.js from loading, which means that no sliders or search results will be shown.

When this happens, the following error will be shown in your console:

Uncaught ReferenceError: Clerk is not defined

There are two ways to handle Require.js. Both approaches require you to make changes to the tracking-script in this file:

app->design->frontend->base->default->template->clerk->tracking.phtml

Include “clerk” in Require.js

The best approach is trying to get Require.js to recognize Clerk.io.

You can do this by inserting require([‘clerk’], function() {}); in the bottom of the tracking script:

Ignoring Require.js

If the above solution doesn’t work, its possible to ignore Require.js.

You can do this by inserting window.__clerk_ignore_requirejs = true;

in the top of the tracking script:

After using one of these approaches, Require.js will now be compatible with Clerk.io.