mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added support for analytics
This commit is contained in:
parent
ebfb76bfac
commit
7723d86c1d
@ -1006,6 +1006,10 @@ class AccountController extends BaseController
|
|||||||
$user->notify_approved = Input::get('notify_approved');
|
$user->notify_approved = Input::get('notify_approved');
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
|
$account = $user->account;
|
||||||
|
$account->fill(request()->all());
|
||||||
|
$account->save();
|
||||||
|
|
||||||
Session::flash('message', trans('texts.updated_settings'));
|
Session::flash('message', trans('texts.updated_settings'));
|
||||||
|
|
||||||
return Redirect::to('settings/'.ACCOUNT_NOTIFICATIONS);
|
return Redirect::to('settings/'.ACCOUNT_NOTIFICATIONS);
|
||||||
|
@ -15,19 +15,26 @@ class AnalyticsListener
|
|||||||
*/
|
*/
|
||||||
public function trackRevenue(PaymentWasCreated $event)
|
public function trackRevenue(PaymentWasCreated $event)
|
||||||
{
|
{
|
||||||
if (! Utils::isNinja() || ! env('ANALYTICS_KEY')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$payment = $event->payment;
|
$payment = $event->payment;
|
||||||
$invoice = $payment->invoice;
|
$invoice = $payment->invoice;
|
||||||
$account = $payment->account;
|
$account = $payment->account;
|
||||||
|
|
||||||
if (! $account->isNinjaAccount() && $account->account_key != NINJA_LICENSE_ACCOUNT_KEY) {
|
$analyticsId = false;
|
||||||
|
|
||||||
|
if ($account->isNinjaAccount() || $account->account_key == NINJA_LICENSE_ACCOUNT_KEY) {
|
||||||
|
$analyticsId = env('ANALYTICS_KEY');
|
||||||
|
} else {
|
||||||
|
if (Utils::isNinja()) {
|
||||||
|
$analyticsId = $account->analytics_key;
|
||||||
|
} else {
|
||||||
|
$analyticsId = $account->analytics_key ?: env('ANALYTICS_KEY');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $analyticsId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$analyticsId = env('ANALYTICS_KEY');
|
|
||||||
$client = $payment->client;
|
$client = $payment->client;
|
||||||
$amount = $payment->amount;
|
$amount = $payment->amount;
|
||||||
$item = $invoice->invoice_items->last()->product_key;
|
$item = $invoice->invoice_items->last()->product_key;
|
||||||
|
@ -170,6 +170,7 @@ class Account extends Eloquent
|
|||||||
'custom_contact_label1',
|
'custom_contact_label1',
|
||||||
'custom_contact_label2',
|
'custom_contact_label2',
|
||||||
'domain_id',
|
'domain_id',
|
||||||
|
'analytics_key',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,6 +69,7 @@ class AddDefaultNoteToClient extends Migration
|
|||||||
$table->renameColumn('custom_design', 'custom_design1');
|
$table->renameColumn('custom_design', 'custom_design1');
|
||||||
$table->mediumText('custom_design2')->nullable();
|
$table->mediumText('custom_design2')->nullable();
|
||||||
$table->mediumText('custom_design3')->nullable();
|
$table->mediumText('custom_design3')->nullable();
|
||||||
|
$table->string('analytics_key')->nullable();
|
||||||
});
|
});
|
||||||
|
|
||||||
DB::statement('update accounts
|
DB::statement('update accounts
|
||||||
@ -100,6 +101,10 @@ class AddDefaultNoteToClient extends Migration
|
|||||||
});
|
});
|
||||||
|
|
||||||
Schema::table('accounts', function ($table) {
|
Schema::table('accounts', function ($table) {
|
||||||
|
$table->renameColumn('custom_design1', 'custom_design');
|
||||||
|
$table->dropColumn('custom_design2');
|
||||||
|
$table->dropColumn('custom_design3');
|
||||||
|
$table->dropColumn('analytics_key');
|
||||||
$table->dropColumn('tax_name1');
|
$table->dropColumn('tax_name1');
|
||||||
$table->dropColumn('tax_rate1');
|
$table->dropColumn('tax_rate1');
|
||||||
$table->dropColumn('tax_name2');
|
$table->dropColumn('tax_name2');
|
||||||
@ -112,12 +117,5 @@ class AddDefaultNoteToClient extends Migration
|
|||||||
$table->dropColumn('tax_name2');
|
$table->dropColumn('tax_name2');
|
||||||
$table->dropColumn('tax_rate2');
|
$table->dropColumn('tax_rate2');
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::table('accounts', function ($table) {
|
|
||||||
$table->renameColumn('custom_design1', 'custom_design');
|
|
||||||
$table->dropColumn('custom_design2');
|
|
||||||
$table->dropColumn('custom_design3');
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -81,7 +81,7 @@ $LANG = array(
|
|||||||
'guest' => 'Guest',
|
'guest' => 'Guest',
|
||||||
'company_details' => 'Company Details',
|
'company_details' => 'Company Details',
|
||||||
'online_payments' => 'Online Payments',
|
'online_payments' => 'Online Payments',
|
||||||
'notifications' => 'Email Notifications',
|
'notifications' => 'Notifications',
|
||||||
'import_export' => 'Import | Export',
|
'import_export' => 'Import | Export',
|
||||||
'done' => 'Done',
|
'done' => 'Done',
|
||||||
'save' => 'Save',
|
'save' => 'Save',
|
||||||
@ -2263,6 +2263,9 @@ $LANG = array(
|
|||||||
'load_design' => 'Load Design',
|
'load_design' => 'Load Design',
|
||||||
'accepted_card_logos' => 'Accepted Card Logos',
|
'accepted_card_logos' => 'Accepted Card Logos',
|
||||||
'phantomjs_local_and_cloud' => 'Using local PhantomJS, falling back to phantomjscloud.com',
|
'phantomjs_local_and_cloud' => 'Using local PhantomJS, falling back to phantomjscloud.com',
|
||||||
|
'google_analytics' => 'Google Analytics',
|
||||||
|
'analytics_key' => 'Analytics Key',
|
||||||
|
'analytics_key_help' => 'Track payments using :link',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -10,6 +10,18 @@
|
|||||||
|
|
||||||
@include('accounts.partials.notifications')
|
@include('accounts.partials.notifications')
|
||||||
|
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">{!! trans('texts.google_analytics') !!}</h3>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
{!! Former::text('analytics_key')
|
||||||
|
->help(trans('texts.analytics_key_help', ['link' => link_to('https://support.google.com/analytics/answer/1037249?hl=en', 'Google Analytics Ecommerce', ['target' => '_blank'])])) !!}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">{!! trans('texts.facebook_and_twitter') !!}</h3>
|
<h3 class="panel-title">{!! trans('texts.facebook_and_twitter') !!}</h3>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user