I have this line of codes at my Controller
to get data from google analytics
$analyticsData = Analytics::performQuery(Period::days(30),
'ga:',
[
'metrics' => 'ga:users,ga:newUsers,ga:sessions,ga:sessionsPerUser,ga:pageviews,ga:pageviewsPerSession,ga:avgSessionDuration,ga:bounceRate',
'start-date' => '2018-08-01',
'end-date' => '2018-09-02',
'dimensions' => 'ga:pageTitle',
]);
When I dd($analyticsData);
This is what I got.
This is my migration query.
Schema::create('analytics', function (Blueprint $table) {
$table->increments('id');
$table->integer('site_id');
$table->string('site_url');
$table->integer('report_id');
$table->integer('analytics_view_id');
$table->date('reportGenerated');
$table->integer('gaUsers');
$table->integer('gaNewUsers');
$table->integer('gaSessions');
$table->integer('gaSessionsPerUser');
$table->integer('gaPageviews');
$table->integer('gaPageviewsPerSession');
$table->integer('gaAvgSession');
$table->integer('gaBounceRate');
});
Now my problem is how can I able to stores those array data to my database? Thank you.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire