Mock installationΒΆ
To do an installation you will have to make sure you configured at least 1 domain.
If you have done that, you can test the code on any domain, by using the code below.
The first block, sets a mockURL. This allows you to simulate the page on which Harvest is tracking events. If you fill in the domain you configure there, you can use Harvest on any page, for example localhost pages.
Also, make sure you will use the correct account name and environment.
<script>
window.harvestConfiguration = {
mockURL: "<demo url>"
};
</script>
<script>
(function (h, a, r, v, e, s, t) {
window.harvest = window.harvest || {};
window.harvest.queue = window.harvest.queue || [];
window.harvest.trackEvent = function (events) {
window.harvest.queue = window.harvest.queue.concat(events);
};
h = document;
a = "script";
r = h.createElement(a);
r.src = "https://cdn.harvest.graindata.com/[account name here]/[environment here]/harvest.js";
r.type = "text/java" + a;
r.async = true;
v = h.getElementsByTagName(a)[0];
v.parentNode.insertBefore(r, v);
harvest.trackEvent({
"event": "pageview",
"data" : {}
});
})();
</script>