How to use Maître in an iframe

If you install Maître inside an iframe, the results might not be what you expect.

By default, Maître takes the url of the current page to create the referral link, but when you use an iframe this url is different because iframes are not aware of the parent's URL. An example will illustrate this concept:

As a result, the referral link generated will be http://mywebsite.com/iframe?mwr=123, instead of the correct http://mywebsite.com?mwr=123.

To solve this problem you just need to tell Maître the correct url in the settings by using the " host" property, as shown in the snippet below:

<script type="text/javascript">
  window.Maitre = {
    uuid: "MFXXXXXX",
    host: "http://mywebsite.com"
  };
</script>
<script data-maitre src='https://maitreapp.co/widget.js' async></script>

From now on Maître will generate referral links using this url instead of the iframe's one.

Please bear in mind that this hack will work for future referral link, however existing referral links won't be changed.

Still need help? Contact Us Contact Us