Skip to main content

Analytics

Analytics is useful for getting site visitor information such as the number of visitors to a page, the average length of time visitors have accessed the site, etc. To use analytics on badaso, you must create Google Analytics account first. After that, get the View ID and Tracking ID from your analytics.

Insert the View ID and Tracking ID from your analytics to .env variable ANALYTICS_VIEW_ID and MIX_ANALYTICS_TRACKING_ID.

To retrieve the site visitor information, you must create a service account for your analytics and download the service-account.json file. After that, you can store it in storage directory like below.

๐Ÿ“ฆ Your Projectโ”ฃ ๐Ÿ“‚ storageโ”ƒ โ”ฃ ๐Ÿ“‚ appโ”ƒ โ”ƒ โ”ฃ ๐Ÿ“‚ analyticsโ”ƒ โ”ƒ โ”ƒ โ”— ๐Ÿ“œ service-account-crendetial.js   /** Store the .json file here. **/
info

You can adjust the service account credential store directory in analytics.php config file.

info

Analytics will only detect visitor from accessing generated CRUD only.

After that you can perform queries using classes provided by spatie/laravel-analytics. If you want to know more about the queries, visit spatie/laravel-analytics.