Cordova App not trackable

Hi everyone,

I do have problems tracking my app that was created with Cordova. It is not possible to track custom events that are send via the dataLayer and received via tags in Tag Manager. It seems that Piwik can’t handle the url the events are send from. Because the url is a path on the users phone.

Piwik standard events, like consent decisions or page view are tracked. It is only custom events that don’t work. They are interpreted as “broken events” (see screenshots)

Is there a way to track custom events from Cordova Apps?



Hi,
Could you try setting the URL fetching in your APP to a valid one or place some template with a placeholder for value so that the tracking request contain a valid URL?

The file://file:// is not a supported URL scheme in Piwik’s case and it should be replaced with a valid URL.

You can validate your URLs by using this link: https://url.spec.whatwg.org/.

Hi @asinior,

you are right, the mentioned URL scheme had been mistyped.

Our problem is that we can neither enter file:///android_asset/www (Android) nor app://localhost (iOS) as valid site or app addresses. This prevents us from tracking through our Cordova based hybrid app. Is it possible to enable the mentioned URL schemes in the form?

Regards,
Stefan

Hi,
Unfortunately, Piwik only supports the URL schemes which I mentioned above and there is no way of enabling such URL schemes to work in the setup because there is a fixed standard that the tracker follows to validate the URLs.

You can try with coming up with a workaround for changing these Cordova URLs to the standard ones.
Here is a stackoverflow thread that may cover the workaround: javascript - how can cordova open app from http or https url? - Stack Overflow