Hello,
we have an AzureFunction to check an ID in the URL-Parameters to prevent duplication. Therefore, I need to call the server-url within a Tag or Variable and get the response status (200 or 409).
But calling it with javascript fetch(url) doesn’t work for me, neither does the old XHR-Request.
I tried something like this for testing:
fetch(apiUrl)
.then(response => {
if (response.status === 200) {
console.log(‘ok’);
} else if (response.status === 409) {
console.log(‘not ok’);
} else {
console.log(Unexpected status: ${response.status}
);
}
})
.catch(error => {
console.error(‘Error making API call:’, error);
});
I get the following error:
“Fetch error: TypeError: Failed to fetch”
To me it looks like the sandboxed Matomo Javascript doesn’t allow this.
Does anyone have experience with this and can help me?