google analytics test

This commit is contained in:
Frank John Begornia
2019-06-19 21:53:01 +08:00
parent 2e79d9b38d
commit c8309e7d3f
12 changed files with 183 additions and 58 deletions

View File

@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Models\MainModel; use App\Models\MainModel;
// use Illuminate\Support\Facades\Request; // use Illuminate\Support\Facades\Request;
use Analytics;
class MainController extends Controller { class MainController extends Controller {
@@ -15,7 +16,9 @@ class MainController extends Controller {
* @return Response * @return Response
*/ */
public function index() public function index()
{ {
$analyticsData = Analytics::getMostVisitedPages(365, 20);
var_dump($analyticsData);
return view('sublayouts.index'); return view('sublayouts.index');
} }

View File

@@ -551,7 +551,7 @@ class DesignerController extends Controller {
// var_dump($this->getProductCode()); // var_dump($this->getProductCode());
$templatepaths_arrays = $newDesignerModel->selectTemplatePathsByTemplateCode($client_design_array[0]->TemplateCode); $templatepaths_arrays = $newDesignerModel->selectTemplatePathsByTemplateCode($client_design_array[0]->TemplateCode);
$array_cat_name = $newMainModel->selectCategoryName($client_design_array[0]->TemplateCode); $array_cat_name = $newMainModel->selectCategoryName($client_design_array[0]->TemplateCode);
$array_cat_name = $newMainModel->selectCategoryName($client_design_array[0]->TemplateCode); // $array_cat_name = $newMainModel->selectCategoryName($client_design_array[0]->TemplateCode);
$array_templates = $newDesignerModel->selectTemplate(md5($client_design_array[0]->TemplateCode)); $array_templates = $newDesignerModel->selectTemplate(md5($client_design_array[0]->TemplateCode));
// var_dump($array_templates); // var_dump($array_templates);
return view('designer.design_preview') return view('designer.design_preview')

View File

@@ -598,8 +598,8 @@ class UserController extends Controller {
$getYear = date('y'); $getYear = date('y');
$store_id = Auth::user()->store_id; $store_id = Auth::user()->store_id;
$templateCode = null; $templateCode = $post['templateCode'];
$designCode = null; $designCode = $post['designCode'];
$itemName = $post['itemName']; $itemName = $post['itemName'];
$itemDescription = $post['itemDescription']; $itemDescription = $post['itemDescription'];
$itemPrice = $post['itemPrice']; $itemPrice = $post['itemPrice'];

View File

@@ -170,4 +170,8 @@ Route::group(['middleware' => 'admin'], function () {
Route::get('cliparts/index', 'cliparts\ClipartsController@index'); Route::get('cliparts/index', 'cliparts\ClipartsController@index');
Route::get('analytics', function (){
$analyticsData = LaravelAnalytics::getVisitorsAndPageViews(7);
});

145
composer.lock generated
View File

@@ -267,25 +267,25 @@
}, },
{ {
"name": "google/recaptcha", "name": "google/recaptcha",
"version": "1.2.1", "version": "1.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/google/recaptcha.git", "url": "https://github.com/google/recaptcha.git",
"reference": "e7add3be59211482ecdb942288f52da64a35f61a" "reference": "c4a17d6af648d4f3814430cd103cba50b75b571c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/google/recaptcha/zipball/e7add3be59211482ecdb942288f52da64a35f61a", "url": "https://api.github.com/repos/google/recaptcha/zipball/c4a17d6af648d4f3814430cd103cba50b75b571c",
"reference": "e7add3be59211482ecdb942288f52da64a35f61a", "reference": "c4a17d6af648d4f3814430cd103cba50b75b571c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.5" "php": ">=5.5"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^2.2.20|^2.12", "friendsofphp/php-cs-fixer": "^2.2.20|^2.15",
"php-coveralls/php-coveralls": "^2.1", "php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7" "phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7.5.11"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@@ -310,7 +310,7 @@
"recaptcha", "recaptcha",
"spam" "spam"
], ],
"time": "2018-08-05T09:31:53+00:00" "time": "2019-05-24T12:44:03+00:00"
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
@@ -652,6 +652,51 @@
], ],
"time": "2018-03-21T22:21:57+00:00" "time": "2018-03-21T22:21:57+00:00"
}, },
{
"name": "kylekatarnls/update-helper",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/kylekatarnls/update-helper.git",
"reference": "b34a46d7f5ec1795b4a15ac9d46b884377262df9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kylekatarnls/update-helper/zipball/b34a46d7f5ec1795b4a15ac9d46b884377262df9",
"reference": "b34a46d7f5ec1795b4a15ac9d46b884377262df9",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.1.0",
"php": ">=5.3.0"
},
"require-dev": {
"codeclimate/php-test-reporter": "dev-master",
"composer/composer": "^2.0.x-dev",
"phpunit/phpunit": ">=4.8.35 <6.0"
},
"type": "composer-plugin",
"extra": {
"class": "UpdateHelper\\ComposerPlugin"
},
"autoload": {
"psr-0": {
"UpdateHelper\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Kyle",
"email": "kylekatarnls@gmail.com"
}
],
"description": "Update helper",
"time": "2019-06-05T08:34:23+00:00"
},
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v5.0.35", "version": "v5.0.35",
@@ -780,16 +825,16 @@
}, },
{ {
"name": "league/flysystem", "name": "league/flysystem",
"version": "1.0.51", "version": "1.0.53",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/flysystem.git", "url": "https://github.com/thephpleague/flysystem.git",
"reference": "755ba7bf3fb9031e6581d091db84d78275874396" "reference": "08e12b7628f035600634a5e76d95b5eb66cea674"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/755ba7bf3fb9031e6581d091db84d78275874396", "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/08e12b7628f035600634a5e76d95b5eb66cea674",
"reference": "755ba7bf3fb9031e6581d091db84d78275874396", "reference": "08e12b7628f035600634a5e76d95b5eb66cea674",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -860,7 +905,7 @@
"sftp", "sftp",
"storage" "storage"
], ],
"time": "2019-03-30T13:22:34+00:00" "time": "2019-06-18T20:09:29+00:00"
}, },
{ {
"name": "league/flysystem-sftp", "name": "league/flysystem-sftp",
@@ -1033,31 +1078,34 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "1.36.2", "version": "1.38.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9" "reference": "8dd4172bfe1784952c4d58c4db725d183b1c23ad"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8dd4172bfe1784952c4d58c4db725d183b1c23ad",
"reference": "cd324b98bc30290f233dd0e75e6ce49f7ab2a6c9", "reference": "8dd4172bfe1784952c4d58c4db725d183b1c23ad",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"kylekatarnls/update-helper": "^1.1",
"php": ">=5.3.9", "php": ">=5.3.9",
"symfony/translation": "~2.6 || ~3.0 || ~4.0" "symfony/translation": "~2.6 || ~3.0 || ~4.0"
}, },
"require-dev": { "require-dev": {
"composer/composer": "^1.2",
"friendsofphp/php-cs-fixer": "~2",
"phpunit/phpunit": "^4.8.35 || ^5.7" "phpunit/phpunit": "^4.8.35 || ^5.7"
}, },
"suggest": { "bin": [
"friendsofphp/php-cs-fixer": "Needed for the `composer phpcs` command. Allow to automatically fix code style.", "bin/upgrade-carbon"
"phpstan/phpstan": "Needed for the `composer phpstan` command. Allow to detect potential errors." ],
},
"type": "library", "type": "library",
"extra": { "extra": {
"update-helper": "Carbon\\Upgrade",
"laravel": { "laravel": {
"providers": [ "providers": [
"Carbon\\Laravel\\ServiceProvider" "Carbon\\Laravel\\ServiceProvider"
@@ -1087,7 +1135,7 @@
"datetime", "datetime",
"time" "time"
], ],
"time": "2018-12-28T10:07:33+00:00" "time": "2019-06-03T15:41:40+00:00"
}, },
{ {
"name": "netshell/paypal", "name": "netshell/paypal",
@@ -1095,19 +1143,19 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/net-shell/laravel-paypal.git", "url": "https://github.com/net-shell/laravel-paypal.git",
"reference": "daced0597091da6aafba3441faebd04f71dfb57a" "reference": "61cccff88b3fba4ab32bafc9542bf2e95c149b5b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/net-shell/laravel-paypal/zipball/daced0597091da6aafba3441faebd04f71dfb57a", "url": "https://api.github.com/repos/net-shell/laravel-paypal/zipball/61cccff88b3fba4ab32bafc9542bf2e95c149b5b",
"reference": "daced0597091da6aafba3441faebd04f71dfb57a", "reference": "61cccff88b3fba4ab32bafc9542bf2e95c149b5b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-curl": "*", "ext-curl": "*",
"ext-json": "*", "ext-json": "*",
"illuminate/support": "~5.0", "illuminate/support": "~5.0",
"paypal/rest-api-sdk-php": "1.6.4", "paypal/rest-api-sdk-php": "1.13.0",
"php": ">=5.3.0" "php": ">=5.3.0"
}, },
"require-dev": { "require-dev": {
@@ -1130,7 +1178,7 @@
} }
], ],
"description": "Laravel-Paypal is simple package help you process direct credit card payments, stored credit card payments and PayPal account payments with your Laravel 5 projects using paypal REST API SDK.", "description": "Laravel-Paypal is simple package help you process direct credit card payments, stored credit card payments and PayPal account payments with your Laravel 5 projects using paypal REST API SDK.",
"time": "2017-02-16T19:13:59+00:00" "time": "2019-04-03T23:00:23+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
@@ -1227,25 +1275,26 @@
}, },
{ {
"name": "paypal/rest-api-sdk-php", "name": "paypal/rest-api-sdk-php",
"version": "v1.6.4", "version": "1.13.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/paypal/PayPal-PHP-SDK.git", "url": "https://github.com/paypal/PayPal-PHP-SDK.git",
"reference": "06837d290c4906578cfd92786412dff330a1429c" "reference": "192e217beed14c8e75624e821fdc8ec51e2a21f5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/06837d290c4906578cfd92786412dff330a1429c", "url": "https://api.github.com/repos/paypal/PayPal-PHP-SDK/zipball/192e217beed14c8e75624e821fdc8ec51e2a21f5",
"reference": "06837d290c4906578cfd92786412dff330a1429c", "reference": "192e217beed14c8e75624e821fdc8ec51e2a21f5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-curl": "*", "ext-curl": "*",
"ext-json": "*", "ext-json": "*",
"php": ">=5.3.0" "php": ">=5.3.0",
"psr/log": "^1.0.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "3.7.*" "phpunit/phpunit": "^4.8.35"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@@ -1255,7 +1304,7 @@
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"Apache2" "Apache-2.0"
], ],
"authors": [ "authors": [
{ {
@@ -1271,20 +1320,20 @@
"rest", "rest",
"sdk" "sdk"
], ],
"time": "2016-01-20T17:45:52+00:00" "time": "2017-11-13T19:21:59+00:00"
}, },
{ {
"name": "phpseclib/phpseclib", "name": "phpseclib/phpseclib",
"version": "2.0.15", "version": "2.0.18",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpseclib/phpseclib.git", "url": "https://github.com/phpseclib/phpseclib.git",
"reference": "11cf67cf78dc4acb18dc9149a57be4aee5036ce0" "reference": "60519001db8d791215a822efd366d24cafee9e63"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/11cf67cf78dc4acb18dc9149a57be4aee5036ce0", "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/60519001db8d791215a822efd366d24cafee9e63",
"reference": "11cf67cf78dc4acb18dc9149a57be4aee5036ce0", "reference": "60519001db8d791215a822efd366d24cafee9e63",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1363,7 +1412,7 @@
"x.509", "x.509",
"x509" "x509"
], ],
"time": "2019-03-10T16:53:45+00:00" "time": "2019-06-13T06:15:54+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@@ -1766,7 +1815,7 @@
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v2.8.49", "version": "v2.8.50",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/event-dispatcher.git", "url": "https://github.com/symfony/event-dispatcher.git",
@@ -1826,7 +1875,7 @@
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v2.8.49", "version": "v2.8.50",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
@@ -2941,16 +2990,16 @@
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
"version": "1.8.0", "version": "1.8.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpspec/prophecy.git", "url": "https://github.com/phpspec/prophecy.git",
"reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76",
"reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2971,8 +3020,8 @@
} }
}, },
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"Prophecy\\": "src/" "Prophecy\\": "src/Prophecy"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@@ -3000,7 +3049,7 @@
"spy", "spy",
"stub" "stub"
], ],
"time": "2018-08-05T17:53:17+00:00" "time": "2019-06-13T12:50:23+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",

View File

@@ -145,9 +145,16 @@ return [
'App\Providers\EventServiceProvider', 'App\Providers\EventServiceProvider',
'App\Providers\RouteServiceProvider', 'App\Providers\RouteServiceProvider',
// paypal /*
* Paypal
*/
'Netshell\Paypal\PaypalServiceProvider', 'Netshell\Paypal\PaypalServiceProvider',
/*
* Google analytics
*/
'Spatie\LaravelAnalytics\LaravelAnalyticsServiceProvider',
], ],
/* /*
@@ -196,6 +203,7 @@ return [
'Validator' => 'Illuminate\Support\Facades\Validator', 'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View', 'View' => 'Illuminate\Support\Facades\View',
'Paypal' => 'Netshell\Paypal\Facades\Paypal', 'Paypal' => 'Netshell\Paypal\Facades\Paypal',
'Analytics' => 'Spatie\LaravelAnalytics\LaravelAnalyticsFacade',
], ],

View File

@@ -0,0 +1,48 @@
<?php
return
[
/*
* The siteId is used to retrieve and display Google Analytics statistics
* in the admin-section.
*
* Should look like: ga:xxxxxxxx.
*/
'siteId' => env('ANALYTICS_SITE_ID'),
/*
* Set the client id
*
* Should look like:
* xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com
*/
'clientId' => env('ANALYTICS_CLIENT_ID'),
/*
* Set the service account name
*
* Should look like:
* xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com
*/
'serviceEmail' => env('ANALYTICS_SERVICE_EMAIL'),
/*
* You need to download a p12-certifciate from the Google API console
* Be sure to store this file in a secure location.
*/
'certificatePath' => storage_path('laravel-analytics/hardy-beach-228905-fab35080b667.p12'),
/*
* The amount of minutes the Google API responses will be cached.
* If you set this to zero, the responses won't be cached at all.
*/
'cacheLifetime' => 60 * 24 * 2,
/*
* The amount of seconds the Google API responses will be cached for
* queries that use the real time query method. If you set this to zero,
* the responses of real time queries won't be cached at all.
*/
'realTimeCacheLifetimeInSeconds' => 5,
];

View File

@@ -111,12 +111,14 @@
</div> </div>
</div> </div>
@if (!Auth::guest())
<div class="panel-footer"> <div class="panel-footer">
<div id="dd_footer_button"> <div id="dd_footer_button">
<a href="{{ url('user/my-designs') }}" type="button" class="btn btn-default pull-right"><i class="fa fa-arrow-left"></i> Go to My Designs</a> <a href="{{ url('user/my-designs') }}" type="button" class="btn btn-default pull-right"><i class="fa fa-arrow-left"></i> Go to My Designs</a>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
@endif
</div> </div>
</div> </div>
</div> </div>

View File

@@ -60,6 +60,15 @@
margin: auto; margin: auto;
} }
</style> </style>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-136108155-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-136108155-1');
</script>
</head> </head>
<body> <body>

View File

@@ -47,12 +47,13 @@
@else @else
@if(Auth::user()->role == "admin") @if(Auth::user()->role == "admin")
<!-- <li class="dropdown-header"><i class="fa fa-user"></i> {{ Auth::user()->username }} </li> --> <li class="dropdown-header"><i class="fa fa-user"></i> {{ Auth::user()->username }} </li>
<li><a href="{{ url('admin') }}">Dashboard</a></li> <li><a href="{{ url('admin') }}">Dashboard</a></li>
@elseif(Auth::user()->role == "store_owner") @elseif(Auth::user()->role == "store_owner")
<li class="dropdown-header"><i class="fa fa-user"></i> {{ Auth::user()->username }} </li>
<li><a href="{{ url('user') }}">Dashboard</a></li> <li><a href="{{ url('user') }}">Dashboard</a></li>
@else @else
<!-- <li class="dropdown-header"><i class="fa fa-user"></i> {{ Auth::user()->username }} </li> --> <li class="dropdown-header"><i class="fa fa-user"></i> {{ Auth::user()->username }} </li>
<li><a href="{{ url('user') }}">Dashboard</a></li> <li><a href="{{ url('user') }}">Dashboard</a></li>
@endif @endif
<li role="separator" class="divider"></li> <li role="separator" class="divider"></li>

View File

@@ -72,7 +72,8 @@
<div class="box-body custom-box-body"> <div class="box-body custom-box-body">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<!-- <input type="hidden" class="form-control" name="item_url" placeholder="Item Name"> --> <input type="hidden" class="form-control" name="templateCode" value="manual_upload">
<input type="hidden" class="form-control" name="designCode" value="manual_upload">
<div class="form-group"> <div class="form-group">
<div id="add_item_response_msg"></div> <div id="add_item_response_msg"></div>
</div> </div>
@@ -95,7 +96,7 @@
<option value="jersey-and-shorts-form">Jersey and Shorts Form</option> <option value="jersey-and-shorts-form">Jersey and Shorts Form</option>
<option value="tshirt-form">T-Shirt Form</option> <option value="tshirt-form">T-Shirt Form</option>
<option value="quantity-form">Quantity Form</option> <option value="quantity-form">Quantity Form</option>
<option value="name-and-number-form">Name and Number Form</option> <option value="name-number-form">Name and Number Form</option>
<option value="name-number-size-form">Name, Number and Size Form</option> <option value="name-number-size-form">Name, Number and Size Form</option>
<option value="number-form">Number Only Form</option> <option value="number-form">Number Only Form</option>
</select> </select>