If you haven't included loop54-js-lib already, include this part and configure it to talk to your loop54 proxy
<script type="text/javascript" src="loop54-js-lib.js"></script>
<script type="text/javascript">
Loop54.setConfig({url: "https://helloworld.54proxy.se"}); // you will get this config from us when we have set up an engine
</script>
Then include the tracking function in a separate javascript file or last in your HTML body tag
<script type="text/javascript">
function track(entities, eventType) {
if(typeof(entities) === "string") { entities = JSON.parse(entities); };
var requestParameters = {
Events: entities.map(function(entity) {
return {
Type: eventType,
Entity: {
EntityType: entity.EntityType,
ExternalId: entity.ExternalId,
},
}
}),
QuestName: "CreateEvents",
};
Loop54.getResponse(requestParameters).then(function(response) {
// here you can put success messages, it"s not required to do anything after an event is sent.
});
};
</script>