Why isn't my Javascript script displaying anything on Shopify?

Why isn't my Javascript script displaying anything on Shopify?

Eothor
Visitor
1 0 0

Hello guys,

 

We have a script that we've been working on that works perfectly on a regular html-file when testing in localhost.

But when trying to publish the code to Shopify everything is blanked and nothing shows up.

 

What could be the issue? I've been scracthing my head now for hours trying to solve this.

 

<script src="https://cdn.ingrid.com/delivery-tracking/bootstrap.js"></script>

<div id="tracking"></div>

<script>
const containerId = "tracking";
function setupWidget(){
const params = new URLSearchParams(window.location.search);
const identifier = params.get("identifier");
const contact = params.get("contact");
if (identifier && contact){
window.IngridDeliveryTrackingWidgetApi.renderPrivateMode({
containerId,
siteId:"7f927e54-7d90-4654-9e7a-4f8264ecd438",
locale: "sv-SE",
identifier: identifier,
contact: contact,
});
return;
}
window.IngridDeliveryTrackingWidgetApi.renderSearchMode({
containerId,
siteId: "7f927e54-7d90-4654-9e7a-4f8264ecd438",
locale: "sv-SE",
prefillContact: contact,
prefillIdentifier: identifier
});
return
}
window.addEventListener("load", () => {
setupWidget();
});
</script>

 

 

Replies 0 (0)