Google Analytics Issue

I have implemented GTAG for logging my game events. It works fine when I launch the project in Playcanvas engine. But when I host the same project on itch.io server, the data does not get registered in the real time analytics on firebase console. I could not see any bug in the logs for the same. I have added the following script in my project.

window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'my_tag_id');

window.gtagTest = function(app) {
    console.log("gtag_is_working");
    gtag('event', 'gtag_is_working', {'tag' : 'test'});
};

Sharing the logs for your reference. The game log is clearly visible in the console which means that the GTAG event is been called but the data is not getting registered in the firebase console.

I have added the following as an external script in the Playcanvas engine.
https://www.googletagmanager.com/gtag/js?id=my_gtag_id

The data gets registered when I launch the project in the Playcanvas engine but does not work the same way when I host it on some server. Please help me out here.

Hi @yash_mehrotra,

I’m don’t think PlayCanvas can break this any way. Can you check if network requests are being sent correctly towards the Google servers? I gather they will be http requests and may be visible in the Network tab.

Is there any chance the itch.io server requires special setup and/or authentication with Google Analytics?

The network tab is empty and I already have configured the analytics on itch.io


I think that’s more of a question for Google support sorry. The only relevant post on this forum I’ve found is this: