> For the complete documentation index, see [llms.txt](https://docs.gomalomo.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gomalomo.com/malomo.js/integrate-with-malomo.js.md).

# Integrate with Malomo.js

Set up Malomo.js to create premium post-purchase experiences

### Set up Malomo.js

Include the following script in the head section of your tracking page. This script must always load directly from **js.gomalomo.com**. You can't include the script in a bundle or host a copy of it yourself.

```javascript
<script src="https://js.gomalomo.com/v2/" type="application/javascript"></script>
```

### Set up Malomo Elements

Elements is available as part of Malomo.js and provides drop-in UI components that you can use to build premium post-purchase experiences.

To create an instance of Elements, use the following JavaScript code.

```javascript
var malomo = Malomo('pk_dd475cb111b894c84e8c0af84e500795');
var elements = malomo.elements();
```

Replace the sample API key with your publishable key. This will allow you to use your Malomo account when using Malomo.js.

### HTTPS Requirement

When you use Elements, all information is submitted over a secure HTTPS connection. To protect yourself from certain forms of man-in-the-middle attacks, and to prevent your customers from seeing [Mixed Content](https://developers.google.com/web/fundamentals/security/prevent-mixed-content/what-is-mixed-content) warnings in modern browsers, you must serve the page that contains Malomo.js over HTTPS as well.

In short, the address of the page that contains Elements must start with **https\://** rather than **http\://.**
