soda-framework / analytics
Soda Framework: Analytics
0.1.5
2017-07-28 04:38 UTC
Requires
- php: >=5.5.9
- google/apiclient: ^2.0
- laravel/framework: ~5.3
- soda-framework/cms: >=0.7
This package is not auto-updated.
Last update: 2024-11-24 04:52:49 UTC
README
A sweet integration with Google Analytics into the Soda Framework
Installation
-
Firstly follow the instructions to install Soda CMS at: https://github.com/soda-framework/cms
-
Install Soda Analytics with composer
#!bash
composer require soda-framework/analytics
-
Add
Soda\Analytics\Providers\AnalyticsServiceProvider::class
-
Run
php artisan vendor:publish
-
Run
php artisan migrate
-
Modify
config/soda/analytics.php
according to your needs:
apis
- Google Console API's Soda Analytics requiresservice-account-name
- The name of the Service Account created for Using OAuth 2.0 for Server to Server Applicationsscheduler
- available cron job intervals for the Analytics scheduler
- Add the following Laravel Blade code to your
<head>
to initialize Google Analytics:
@include('soda-analytics::analytics')
Configuration
- Log into the CMS
- Go to Analytics > Configure
- Complete all the steps, in order, to enable and create the relevant apis and access keys.
- You're ready. Start using Analytics > Audience, Events, Schedules.
Usage
Sending Events
Send events as normal with Google Analytics:
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
Or use our helper function:
send_event([eventCategory], [eventAction], [eventLabel] (optional), [eventValue] (optional));
For best results, try to use all the parameters.
Analyzing Events
- Log into the CMS
- Go to Analytics > Events
Analyzing Audience
- Log into the CMS
- Go to Analytics > Audience
Creating Schedules
- Log into the CMS
- Go to Analytics > Schedules
- Choose your desired schedule frequency (the same frequency is used for all schedules)
- Enter the displayed
cron
command onto your server (using thecrontab -e
command) - Create a new schedule
- Choose the type. Event will send event data, Audience, audience data, Events and Audience will send both.
- Enter at least one email to send the report to.
- Click save.
- You can test your schedule by clicking
Run Schedule