Since Joomla 3.9, there is a plugin integrated to manage privacy policy. The documentation is available here:
https://docs.joomla.org/J3.x:Privacy
https://docs.joomla.org/Privacy_Guidance_for_Joomla_Extensions
Since Joomla 3.9, there is a plugin integrated to manage privacy policy. The documentation is available here:
https://docs.joomla.org/J3.x:Privacy
https://docs.joomla.org/Privacy_Guidance_for_Joomla_Extensions
Issue: it may occurs that you have to call a function that is conditionally set. A frequent use case would be GDPR where you set your tracking script conditionally. You micht check the cookie for each event you track, but I think a better solution would be to track if the function is declared.
Solution:
There are two different options:
Option 1:
This option will still return an error in case the function to evaluate is not defined.
function isFunction(TrackingScript) { TrackingScript ('button-click','cart',10); }
Option 2:
if (typeof(
TrackingScript) === typeof(Function)){
TrackingScript ('button-click','cart',10);}