I'm using TrackJS in SPA, i have logic related to GDPR, so I can NOT send any data before consent given.
I found onError
config option which help with this.
But i still have external request to https://usage.trackjs.com/usage.gif
. I can disable this by some tricks but it doesn't looks correct way.
So how to prevent usage call?
Example of implementation:
import { TrackJS } from 'trackjs';
let GLOBAL_VARIABLE_IS_CONSENT_GIVEN = false;
TrackJS.install({
usageURL: '#', // disable usage call
onError: function() {
if (!GLOBAL_VARIABLE_IS_CONSENT_GIVEN) {
return false;
}
// other logic
return true;
},
});
I also found issue with usage call in SPA. It will not show actual page view result. So it will be good to have support to call usage request manually, it will solve two issues above. Found that it's known limitation: https://docs.trackjs.com/data-management/pageviews/