PHP code example of wpdew / helperpack
1. Go to this page and download the library: Download wpdew/helperpack library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wpdew / helperpack example snippets
php artisan vendor:publish --provider="Wpdew\HelperPack\LaravelWpdewServiceProvider" --tag="config"
$gamp = new WpdewGamp();
$analytics = $gamp->initializeAnalytics();
$data_user = [
"setStartDate" => "7daysAgo",
"setEndDate" => "today",
"setExpression" => "ga:users",
"setAlias" => "setAlias",
];
$response_user = $gamp->getReport($analytics , $data_user);
$resuse_week = $gamp->printResults($response_user);
$analitycs = new WpdewGa4;
$getdata_user_week = [
'start_date' => '7daysAgo', // 'YYYY-MM-DD', today, yesterday, 7daysAgo, 14daysAgo, 30daysAgo, 90daysAgo, 365daysAgo, 1095daysAgo
'end_date' => 'today', // 'YYYY-MM-DD', today, yesterday, 7daysAgo, 14daysAgo, 30daysAgo, 90daysAgo, 365daysAgo, 1095daysAgo
'metric' => 'activeUsers' // activeUsers, newUsers, sessions, totalUsers, screenPageViews
];
$users_day_week = $analitycs->getMetriks($getdata_user_week);
$analitycs = new WpdewGa4;
$getdata_user_week = [
'start_date' => '7daysAgo', //7daysAgo, 30daysAgo,
'end_date' => 'today',
'metric' => 'activeUsers' //screenPageViews
];
$users_week = $analitycs->phpgetMetriks($getdata_user_week);
$analitycs = new WpdewGa4;
$getdata_user_week = [
'start_date' => '7daysAgo', //7daysAgo, 30daysAgo,
'end_date' => 'today',
'metric' => 'activeUsers' //screenPageViews
];
$users_week = $analitycs->phpgetMetriks($getdata_user_week);