Reputation: 292
I made a REST API with Laravel, basically I get they route pass the route to the controller and from the controller I get the data and return a json formatted response, I was wondering If there is any way to add Google Analytics tracking to this.
Thanks.
Upvotes: 2
Views: 4681
Reputation: 531
Your best bet seems to be the Google Analytics Measurement Protocol:
https://developers.google.com/analytics/devguides/collection/protocol/v1/
Also, since Laravel has the ability to run packages, it appears someone has already created an appropriate package for Laravel:
https://github.com/irazasyed/laravel-gamp
Note - I have not tried this package so I can't say whether it will save time over implementing the calls directly according to the GAMP docs.
Upvotes: 1