how to add google analytics in laravel website code example
Example: add google analytics to website laravel
@if(\Settings::get('google_analytics_id'))
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async
src="https://www.googletagmanager.com/gtag/js?id={{ \Settings::get('google_analytics_id') }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', "{{ \Settings::get('google_analytics_id') }}");
</script>
@endif