Where’s or how is the best way to include a global function? I have done a small cookie consent for me and now I have to check at multiple places for the cookie with this:
if ( Cookie::get('consent') == 'all' && $page->uid() != 'error' ) {
// stuff here
}
But I have noticed that some of the analytics codes have a lot of ’ and ", is there any way to avoid this or works only with escaping? Cause this will make problems:
That was the trick. In fact, it would look really dirty to use a long string as function argument.
In fact, if you have different analytics strings, you would probably want to store them somewhere (in the site content or config or a text file) and then retrieve from there to pass as argument.