How to add the helloretail javascript

How to add the helloretail javascript

Manually installing the helloretail javascript

 

In order for helloretail to start collecting data about your products and visitors, you’ll need to add the helloretail JavaScript to your site.

What’s a JavaScript?

A JavaScript is a piece of code that tells your website to carry out particular actions. You don’t need to write this piece of code yourself or understand how it works, all you need to do is paste it into the code of your site.

What does the helloretail javascript do?

The helloretail JavaScript collects information about your products and customers to send them back to the helloretail servers. Once we have that information, we analyze it to produce product recommendations based on the information sent to helloretail about your visitors (by the JavaScript). Then helloretail send these recommendations back to your webshop, to be loaded automatically when someone is viewing your webshop. Although this sounds like a lot of work – it actually just happens within milliseconds!

You can read more about the helloretail JavaScript here.

Where can I paste the JavaScript?

You can place the JavaScript anywhere in your HTML template – it can either be in the head or the body. But we recommend putting it in an obvious place – such as right at the top or bottom of your code. All you need to do is select the piece of code below, copy it, and then paste it into your HTML template.

Here’s the code you’ll need to copy and paste:

<script type="text/javascript">
        (function() {
                var aws = document.createElement('script');
                aws.type = 'text/javascript';
                if (typeof(aws.async) != "undefined") { aws.async = true; }
                aws.src = (window.location.protocol == 'https:' ? 'https://d1pna5l3xsntoj.cloudfront.net' : 'http://cdn.addwish.com') + '/scripts/company/awAddGift.js#YOUR_PARTNER_ID';
                var s = document.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(aws, s);
        })();
</script>

Note: Once you have pasted it into your HTML template, you should replace YOUR_PARTNER_ID with your own helloretail partner ID. You can find your helloretail partner ID by logging into your admin account.

Installing the JavaScript through Google Tag Manager

Google Tag Manager is an easy way to manage the code snippets you have on your webshop ("tag" is just another name for a piece of code). If you don’t have a developer on your team and you don’t feel confident adding the JavaScript yourself – this might be the best option. 

To learn more about how Google Tag Manager works, check out their site here.

Here’s a short video, showing how to add the helloretail JavaScript using Google Tag Manager:

If you get stuck at any point, just give one of our team members a call – we’ll be happy to guide you through the process.

 

Advanced: If you are using RequireJS

Note: If you are using RequireJS on your site, the helloretail partner JavaScript should be loaded slightly different – to ensure, jQuery are loaded before the helloretail partner JavaScript. Here's how:

<script type="text/javascript">
    require(['jquery'], function ($) {
        (function() {
                var aws = document.createElement('script');
                aws.type = 'text/javascript';
                if (typeof(aws.async) != "undefined") { aws.async = true; }
                aws.src = (window.location.protocol == 'https:' ? 'https://d1pna5l3xsntoj.cloudfront.net' : 'http://cdn.addwish.com') + '/scripts/company/awAddGift.js#YOUR_PARTNER_ID';
                var s = document.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(aws, s);
        })();
    });
</script>

Note: Once you have pasted it into your HTML template, you should replace YOUR_PARTNER_ID with your own helloretail partner ID. You can find your helloretail partner ID by logging into your admin account.

Follow
  • 4 mths agoLast active
  • 161Views
  • 1 Following