I want to show my google analytics UA code based on localhost (local development) or live server. I think there are a few options such as storing the UA code in the .env file but i’d prefer to just have an if else statement in the blade file for the head layout.
laravel blade if localhost (i use an alias local. but you can change that to localhost if you want).
ga(‘create’, ‘UA-788xxx55-4’, ‘auto’); //live
ga(‘create’, ‘UA-788xxx55-5’, ‘auto’); //localhost