Most of the heatmap functions are controlled inside Optimize. However, for heatmaps to work, the Optimize script must be installed on the target website.
Basic setup¶
The basic requirements for heatmaps to work are the presence of the Optimize token and the heatmap enabled attribute set to true
.
Example¶
<script type="text/javascript">
window._monsido = window._monsido || {
token: "insert-your-monsido-token-here",
heatmap: {
enabled: true
}
};
</script>
<script type="text/javascript" async src="https://app-script.monsido.com/v2/monsido-script.js"></script>
How it works¶
The heatmap function will automatically run on page load. It will determine the heatmaps should run on a particular session based on how heatmaps have been configured for your Optimize account.
Heatmaps on Single-Page Applications (SPA)¶
If heatmaps are applied to an SPA, by default, the heatmaps function runs on page load and sends its data when the page unloads.
It is possible to simulate an unload by using this command:
window.monsido_functions.sendHeatmapData();
You must restart the heatmap function after the URL has changed, using this command:
window.monsido_functions.resetHeatmap();