Magento

Edgemesh installation Instructions for Magento ECommerce.

In order to install Edgemesh on Magento, please ensure your site meets the Prerequisites before continuing.

Install the Service Worker

The process to install the Edgemesh Service Worker is the same acon both Magento 1 and Magento 2.

First you will need to create a file in the root of your web server. Often times the root is www/html but if your root is different you can find it quickly by locating the main index.php of your Magento installation.

Once you find the root directory, create a file called sw.js and add the following code:

sw.js
sw.js
importScripts('https://static.edgeme.sh/edgemesh-sw.js')

Installing the Client will be specific to each version. The instructions are layed out below.

Install the Client

There are many ways to install the Edgemesh client on a Magento site. An experienced Magento engineer could install Edgemesh for specific pages or themes, but here we are going to cover the most efficient way to install Edgemesh to cover your entire Frontend.

Magento 1.x

We will be creating a custom module for Edgemesh so It can easily be enabled and disabled from System > Configuration > Advanced > Advanced.

All of the below file names and content are case sensitive. Please copy exactly.

First, lets create the Edgemesh Client loader.

app/design/frontend/base/default/layout/edgemesh.xml
app/design/frontend/base/default/layout/edgemesh.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="head">
<block type="core/text" name="mapcontrol.script.block">
<action method="setText"><text><![CDATA[<script async type="text/javascript" src="https://static.edgeme.sh/client.js" onload="window.edgemesh = new Edgemesh()"></script>]]></text></action>
</block>
</reference>
</default>
</layout>

Then, lets create a module config:

app/code/local/Edgemesh/Client/etc/config.xml
app/code/local/Edgemesh/Client/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Edgemesh_Client>
<version>3.1.0</version>
</Edgemesh_Client>
</modules>
<frontend>
<layout>
<updates>
<module>
<file>edgemesh.xml</file>
</module>
</updates>
</layout>
</frontend>
</config>

Finally, lets tell Magento about our module:

app/etc/modules/Edgemesh_Client.xml
app/etc/modules/Edgemesh_Client.xml
<?xml version="1.0"?>
<config>
<modules>
<Edgemesh_Client>
<active>true</active>
<codePool>local</codePool>
</Edgemesh_Client>
</modules>
</config>

Now you can refresh your caches by going to System > Cache Management, selecting Configuration and Layouts, selecting Refresh from the action drop down and clicking the Submit button. The Edgemesh Client is now installed on your Magento 1 site. You can now complete your installation by verifying your domain on the Edgemesh Portal.

Magento 2.X

Navigate to your admin area and go to Content > Configuration :

Click edit on your active store view:

Scroll down to Other Options > HTML Head and find the Scripts and Style Sheets input. Add the following code to the input.

If there are other scripts or style sheets in the input, be sure to add the Edgemesh Client code on a new line.

<script
async
type="text/javascript"
src="https://static.edgeme.sh/client.js"
onload="window.edgemesh = new Edgemesh()">
</script>

It should look something like this:

Click Save Configuration on the top right and you can now complete your installation by verifying your domain on the Edgemesh Portal.