First of all- install package.
composer require ezitisitis/laravel-social-trackers
Now populate services
config with config values:
'google_tag_manager_id' => env('GOOGLE_TAG_MANAGER_ID'),
Simply put Tracker::your_desired_tracker
to the head
section. For example:
<head>
...
{{\Ezitisitis\LaravelTracking\Tracker::googleTagManager()}}
...
</head>
<body>
{{\Ezitisitis\LaravelTracking\Tracker::googleTagManagerNoScript()}}
...
</body>