Add some Google analytics for the installer and then vaCentral connections
This commit is contained in:
parent
3da403671a
commit
467a1a1dc6
@ -63,6 +63,7 @@ return [
|
||||
SebastiaanLuca\Helpers\Collections\CollectionMacrosServiceProvider::class,
|
||||
Toin0u\Geotools\GeotoolsServiceProvider::class,
|
||||
Jackiedo\Timezonelist\TimezonelistServiceProvider::class,
|
||||
Irazasyed\LaravelGAMP\LaravelGAMPServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
|
96
config/gamp.php
Normal file
96
config/gamp.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Google Analytics Tracking / Web Property ID [REQUIRED]
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Your Google Analytics tracking ID / web property ID. The format is UA-XXXX-Y.
|
||||
| All collected data is associated by this ID.
|
||||
|
|
||||
| Refer:
|
||||
| https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#tid
|
||||
|
|
||||
*/
|
||||
'tracking_id' => 'UA-100567975-1',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Measurement Protocol Version [REQUIRED]
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The Protocol version. The current value is '1'.
|
||||
| This will only change when there are changes made that are not backwards compatible.
|
||||
|
|
||||
| Refer:
|
||||
| https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#v
|
||||
|
|
||||
| Default: 1
|
||||
|
|
||||
*/
|
||||
'protocol_version' => 1,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| URL Endpoint - SSL Support: Send Data over SSL [Optional]
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the URL endpoint of the Measurement Protocol.
|
||||
| To send data over SSL, set true.
|
||||
|
|
||||
| Refer:
|
||||
| https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#tid
|
||||
|
|
||||
| Default: false
|
||||
| Valid Values: (Boolean) "true" OR "false"
|
||||
|
|
||||
*/
|
||||
'is_ssl' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Disable Hits [Optional]
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls enabling or disabling the library.
|
||||
| Useful in Staging/Dev environments when you don't want to actually send hits to GA.
|
||||
| When disabled, it returns a AnalyticsResponseInterface object that returns empty values.
|
||||
|
|
||||
| To disable library hits, set true.
|
||||
|
|
||||
| Default: false
|
||||
| Valid Values: (Boolean) "true" OR "false"
|
||||
|
|
||||
*/
|
||||
'is_disabled' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Anonymize IP [Optional]
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to True, the IP address of the sender will be anonymized.
|
||||
|
|
||||
| Refer:
|
||||
| https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#aip
|
||||
|
|
||||
| Default: false
|
||||
| Valid Values: (Boolean) "true" OR "false"
|
||||
|
|
||||
*/
|
||||
'anonymize_ip' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Asynchronous Requests [Optional]
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set to True, All the requests would be made non-blocking (Async).
|
||||
|
|
||||
| Default: false
|
||||
| Valid Values: (Boolean) "true" OR "false"
|
||||
|
|
||||
*/
|
||||
'async_requests' => false,
|
||||
];
|
@ -23,6 +23,8 @@ APP_LOG=daily
|
||||
APP_LOG_LEVEL=debug
|
||||
APP_LOG_MAX_FILES=3
|
||||
|
||||
APP_ENABLE_ANALYTICS=true
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=localhost
|
||||
DB_PORT=3306
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Modules\Installer\Http\Controllers;
|
||||
|
||||
use Irazasyed\LaravelGAMP\Facades\GAMP;
|
||||
use Log;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
@ -52,6 +53,11 @@ class InstallerController extends Controller
|
||||
return view('installer::errors/already-installed');
|
||||
}
|
||||
|
||||
/*$gamp = GAMP::setClientId(uniqid('', true));
|
||||
$gamp->setDocumentPath('/install');
|
||||
$gamp->setCustomDimension(PHP_VERSION, 1);
|
||||
$gamp->sendPageview();*/
|
||||
|
||||
return view('installer::index-start');
|
||||
}
|
||||
|
||||
@ -204,6 +210,10 @@ class InstallerController extends Controller
|
||||
*/
|
||||
public function step3(Request $request)
|
||||
{
|
||||
/*$this->envService->updateKeyInFile([
|
||||
'APP_ENABLE_ANALYTICS' => 'false'
|
||||
]);*/
|
||||
|
||||
return view('installer::steps/step3-user', []);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
@extends('installer::app')
|
||||
@section('title', 'Install phpVMS')
|
||||
|
||||
@section('content')
|
||||
<h2>phpvms installer</h2>
|
||||
|
@ -64,13 +64,33 @@
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><p>Password Confirm</p></td>
|
||||
<td width="40%"><p>Password Confirm</p></td>
|
||||
<td>
|
||||
{!! Form::password('password_confirmation', ['class' => 'form-control']) !!}
|
||||
@include('installer::flash/check_error', ['field' => 'password_confirmation'])
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><h4>Options</h4></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><p>Analytics</p></td>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
{!! Form::hidden('hidden', 0) !!}
|
||||
{!! Form::checkbox('analytics', 1, true, ['class' => 'form-control']) !!}
|
||||
<br />
|
||||
<p>
|
||||
Allow collection of analytics. They're anonymized, and helps us track
|
||||
the PHP and database versions that are used, and help to figure out problems
|
||||
and slowdowns when vaCentral integration is enabled.
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="dbtest"></div>
|
||||
<p style="text-align: right">
|
||||
|
@ -19,6 +19,8 @@ APP_LOG=daily
|
||||
APP_LOG_LEVEL=debug
|
||||
APP_LOG_MAX_FILES=3
|
||||
|
||||
APP_ENABLE_ANALYTICS=true
|
||||
|
||||
DB_CONNECTION={!! $DB_CONN !!}
|
||||
DB_HOST={!! $DB_HOST !!}
|
||||
DB_PORT={!! $DB_PORT !!}
|
||||
|
@ -41,6 +41,33 @@ class EnvironmentService
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the environment file and update certain keys/values
|
||||
* @param array $kvp
|
||||
* @return void
|
||||
*/
|
||||
public function updateKeysInEnv(array $kvp)
|
||||
{
|
||||
$app = app();
|
||||
|
||||
$env_file = file_get_contents($app->environmentFilePath());
|
||||
foreach($kvp as $key => $value) {
|
||||
|
||||
# cast
|
||||
if(\is_bool($value)) {
|
||||
$value = $value === true ? 'true' : 'false';
|
||||
}
|
||||
|
||||
$env_file = preg_replace(
|
||||
'/^' . $key . '(.*)?/m',
|
||||
$key . '=' . $value,
|
||||
$env_file
|
||||
);
|
||||
}
|
||||
|
||||
file_put_contents($app->environmentFilePath(), $env_file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a fresh new APP_KEY
|
||||
* @return string
|
||||
@ -51,11 +78,17 @@ class EnvironmentService
|
||||
}
|
||||
|
||||
/**
|
||||
* Change a few options within the PDO driver, depending on the version
|
||||
* of mysql/maria, etc used. ATM, only make a change for MariaDB
|
||||
* @param $opts
|
||||
* @return mixed
|
||||
*/
|
||||
protected function determinePdoOptions($opts)
|
||||
{
|
||||
if($opts['DB_CONN'] !== 'mysql') {
|
||||
return $opts;
|
||||
}
|
||||
|
||||
$dsn = "mysql:host=$opts[DB_HOST];port=$opts[DB_PORT];";
|
||||
Log::info('Connection string: ' . $dsn);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user