New GA events [skip ci]

This commit is contained in:
James Cole 2015-05-25 08:12:31 +02:00
parent 8ece341467
commit 60fe8ce011
9 changed files with 55 additions and 1 deletions

View File

@ -43,6 +43,8 @@ class BillController extends Controller
Session::put('bills.create.url', URL::previous()); Session::put('bills.create.url', URL::previous());
} }
Session::forget('bills.create.fromStore'); Session::forget('bills.create.fromStore');
Session::flash('gaEventCategory', 'bills');
Session::flash('gaEventAction', 'create');
$subTitle = 'Create new bill'; $subTitle = 'Create new bill';
return view('bills.create', compact('periods', 'subTitle')); return view('bills.create', compact('periods', 'subTitle'));
@ -57,6 +59,8 @@ class BillController extends Controller
{ {
// put previous url in session // put previous url in session
Session::put('bills.delete.url', URL::previous()); Session::put('bills.delete.url', URL::previous());
Session::flash('gaEventCategory', 'bills');
Session::flash('gaEventAction', 'delete');
$subTitle = 'Delete "' . e($bill->name) . '"'; $subTitle = 'Delete "' . e($bill->name) . '"';
return view('bills.delete', compact('bill', 'subTitle')); return view('bills.delete', compact('bill', 'subTitle'));
@ -93,6 +97,8 @@ class BillController extends Controller
Session::put('bills.edit.url', URL::previous()); Session::put('bills.edit.url', URL::previous());
} }
Session::forget('bills.edit.fromUpdate'); Session::forget('bills.edit.fromUpdate');
Session::flash('gaEventCategory', 'bills');
Session::flash('gaEventAction', 'edit');
return view('bills.edit', compact('subTitle', 'periods', 'bill')); return view('bills.edit', compact('subTitle', 'periods', 'bill'));
} }

View File

@ -64,6 +64,8 @@ class BudgetController extends Controller
Session::put('budgets.create.url', URL::previous()); Session::put('budgets.create.url', URL::previous());
} }
Session::forget('budgets.create.fromStore'); Session::forget('budgets.create.fromStore');
Session::flash('gaEventCategory', 'budgets');
Session::flash('gaEventAction', 'create');
$subTitle = trans('firefly.create_new_budget'); $subTitle = trans('firefly.create_new_budget');
return view('budgets.create', compact('subTitle')); return view('budgets.create', compact('subTitle'));
@ -80,6 +82,8 @@ class BudgetController extends Controller
// put previous url in session // put previous url in session
Session::put('budgets.delete.url', URL::previous()); Session::put('budgets.delete.url', URL::previous());
Session::flash('gaEventCategory', 'budgets');
Session::flash('gaEventAction', 'delete');
return view('budgets.delete', compact('budget', 'subTitle')); return view('budgets.delete', compact('budget', 'subTitle'));
} }
@ -99,6 +103,7 @@ class BudgetController extends Controller
Session::flash('success', 'The budget "' . e($name) . '" was deleted.'); Session::flash('success', 'The budget "' . e($name) . '" was deleted.');
return Redirect::to(Session::get('budgets.delete.url')); return Redirect::to(Session::get('budgets.delete.url'));
} }
@ -116,6 +121,8 @@ class BudgetController extends Controller
Session::put('budgets.edit.url', URL::previous()); Session::put('budgets.edit.url', URL::previous());
} }
Session::forget('budgets.edit.fromUpdate'); Session::forget('budgets.edit.fromUpdate');
Session::flash('gaEventCategory', 'budgets');
Session::flash('gaEventAction', 'edit');
return view('budgets.edit', compact('budget', 'subTitle')); return view('budgets.edit', compact('budget', 'subTitle'));

View File

@ -40,6 +40,8 @@ class CategoryController extends Controller
Session::put('categories.create.url', URL::previous()); Session::put('categories.create.url', URL::previous());
} }
Session::forget('categories.create.fromStore'); Session::forget('categories.create.fromStore');
Session::flash('gaEventCategory', 'categories');
Session::flash('gaEventAction', 'create');
$subTitle = 'Create a new category'; $subTitle = 'Create a new category';
return view('categories.create', compact('subTitle')); return view('categories.create', compact('subTitle'));
@ -56,6 +58,8 @@ class CategoryController extends Controller
// put previous url in session // put previous url in session
Session::put('categories.delete.url', URL::previous()); Session::put('categories.delete.url', URL::previous());
Session::flash('gaEventCategory', 'categories');
Session::flash('gaEventAction', 'delete');
return view('categories.delete', compact('category', 'subTitle')); return view('categories.delete', compact('category', 'subTitle'));
} }
@ -91,6 +95,8 @@ class CategoryController extends Controller
Session::put('categories.edit.url', URL::previous()); Session::put('categories.edit.url', URL::previous());
} }
Session::forget('categories.edit.fromUpdate'); Session::forget('categories.edit.fromUpdate');
Session::flash('gaEventCategory', 'categories');
Session::flash('gaEventAction', 'edit');
return view('categories.edit', compact('category', 'subTitle')); return view('categories.edit', compact('category', 'subTitle'));

View File

@ -45,6 +45,8 @@ class CurrencyController extends Controller
Session::put('currency.create.url', URL::previous()); Session::put('currency.create.url', URL::previous());
} }
Session::forget('currency.create.fromStore'); Session::forget('currency.create.fromStore');
Session::flash('gaEventCategory', 'currency');
Session::flash('gaEventAction', 'create');
return view('currency.create', compact('subTitleIcon', 'subTitle')); return view('currency.create', compact('subTitleIcon', 'subTitle'));
} }
@ -84,6 +86,8 @@ class CurrencyController extends Controller
// put previous url in session // put previous url in session
Session::put('currency.delete.url', URL::previous()); Session::put('currency.delete.url', URL::previous());
Session::flash('gaEventCategory', 'currency');
Session::flash('gaEventAction', 'delete');
return view('currency.delete', compact('currency')); return view('currency.delete', compact('currency'));
@ -127,6 +131,8 @@ class CurrencyController extends Controller
Session::put('currency.edit.url', URL::previous()); Session::put('currency.edit.url', URL::previous());
} }
Session::forget('currency.edit.fromUpdate'); Session::forget('currency.edit.fromUpdate');
Session::flash('gaEventCategory', 'currency');
Session::flash('gaEventAction', 'edit');
return view('currency.edit', compact('currency', 'subTitle', 'subTitleIcon')); return view('currency.edit', compact('currency', 'subTitle', 'subTitleIcon'));

View File

@ -72,6 +72,8 @@ class PiggyBankController extends Controller
Session::put('piggy-banks.create.url', URL::previous()); Session::put('piggy-banks.create.url', URL::previous());
} }
Session::forget('piggy-banks.create.fromStore'); Session::forget('piggy-banks.create.fromStore');
Session::flash('gaEventCategory', 'piggy-banks');
Session::flash('gaEventAction', 'create');
return view('piggy-banks.create', compact('accounts', 'periods', 'subTitle', 'subTitleIcon')); return view('piggy-banks.create', compact('accounts', 'periods', 'subTitle', 'subTitleIcon'));
} }
@ -87,6 +89,8 @@ class PiggyBankController extends Controller
// put previous url in session // put previous url in session
Session::put('piggy-banks.delete.url', URL::previous()); Session::put('piggy-banks.delete.url', URL::previous());
Session::flash('gaEventCategory', 'piggy-banks');
Session::flash('gaEventAction', 'delete');
return view('piggy-banks.delete', compact('piggyBank', 'subTitle')); return view('piggy-banks.delete', compact('piggyBank', 'subTitle'));
} }
@ -138,6 +142,8 @@ class PiggyBankController extends Controller
'remind_me' => intval($piggyBank->remind_me) == 1 && !is_null($piggyBank->reminder) ? true : false 'remind_me' => intval($piggyBank->remind_me) == 1 && !is_null($piggyBank->reminder) ? true : false
]; ];
Session::flash('preFilled', $preFilled); Session::flash('preFilled', $preFilled);
Session::flash('gaEventCategory', 'piggy-banks');
Session::flash('gaEventAction', 'edit');
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (Session::get('piggy-banks.edit.fromUpdate') !== true) { if (Session::get('piggy-banks.edit.fromUpdate') !== true) {

View File

@ -90,6 +90,10 @@ class ReportController extends Controller
$balance = $this->helper->getBalanceReport($start, $end, $shared); $balance = $this->helper->getBalanceReport($start, $end, $shared);
$bills = $this->helper->getBillReport($start, $end, $shared); $bills = $this->helper->getBillReport($start, $end, $shared);
Session::flash('gaEventCategory', 'report');
Session::flash('gaEventAction', 'month');
Session::flash('gaEventLabel', $start->format('F Y'));
return view( return view(
'reports.month', 'reports.month',
@ -133,6 +137,10 @@ class ReportController extends Controller
$incomes = $this->helper->getIncomeReport($start, $end, $shared); $incomes = $this->helper->getIncomeReport($start, $end, $shared);
$expenses = $this->helper->getExpenseReport($start, $end, $shared); $expenses = $this->helper->getExpenseReport($start, $end, $shared);
Session::flash('gaEventCategory', 'report');
Session::flash('gaEventAction', 'year');
Session::flash('gaEventLabel', $start->format('Y'));
return view( return view(
'reports.year', 'reports.year',

View File

@ -70,6 +70,8 @@ class TagController extends Controller
Session::put('tags.create.url', URL::previous()); Session::put('tags.create.url', URL::previous());
} }
Session::forget('tags.create.fromStore'); Session::forget('tags.create.fromStore');
Session::flash('gaEventCategory', 'tags');
Session::flash('gaEventAction', 'create');
return view('tags.create', compact('subTitle', 'subTitleIcon')); return view('tags.create', compact('subTitle', 'subTitleIcon'));
} }
@ -85,6 +87,8 @@ class TagController extends Controller
// put previous url in session // put previous url in session
Session::put('tags.delete.url', URL::previous()); Session::put('tags.delete.url', URL::previous());
Session::flash('gaEventCategory', 'tags');
Session::flash('gaEventAction', 'delete');
return view('tags.delete', compact('tag', 'subTitle')); return view('tags.delete', compact('tag', 'subTitle'));
} }
@ -141,6 +145,8 @@ class TagController extends Controller
Session::put('tags.edit.url', URL::previous()); Session::put('tags.edit.url', URL::previous());
} }
Session::forget('tags.edit.fromUpdate'); Session::forget('tags.edit.fromUpdate');
Session::flash('gaEventCategory', 'tags');
Session::flash('gaEventAction', 'edit');
return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'tagOptions')); return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'tagOptions'));
} }

View File

@ -62,6 +62,8 @@ class TransactionController extends Controller
Session::put('transactions.create.url', URL::previous()); Session::put('transactions.create.url', URL::previous());
} }
Session::forget('transactions.create.fromStore'); Session::forget('transactions.create.fromStore');
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'create-' . $what);
asort($piggies); asort($piggies);
@ -83,6 +85,8 @@ class TransactionController extends Controller
// put previous url in session // put previous url in session
Session::put('transactions.delete.url', URL::previous()); Session::put('transactions.delete.url', URL::previous());
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'delete-' . $type);
return view('transactions.delete', compact('journal', 'subTitle')); return view('transactions.delete', compact('journal', 'subTitle'));
@ -158,6 +162,8 @@ class TransactionController extends Controller
$preFilled['account_to_id'] = $transactions[0]->account->id; $preFilled['account_to_id'] = $transactions[0]->account->id;
Session::flash('preFilled', $preFilled); Session::flash('preFilled', $preFilled);
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'edit-' . $what);
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").
if (Session::get('transactions.edit.fromUpdate') !== true) { if (Session::get('transactions.edit.fromUpdate') !== true) {

View File

@ -169,9 +169,12 @@
ga('send', 'pageview'); ga('send', 'pageview');
// send an event if relevant: // send an event if relevant:
{% if Session.has('gaEventCategory') and Session.has('gaEventAction') %} {% if Session.has('gaEventCategory') and Session.has('gaEventAction') and not Session.has('gaEventLabel') %}
ga('send', 'event', '{{Session.get('gaEventCategory')}}', '{{Session.get('gaEventAction')}}'); ga('send', 'event', '{{Session.get('gaEventCategory')}}', '{{Session.get('gaEventAction')}}');
{% endif %} {% endif %}
{% if Session.has('gaEventCategory') and Session.has('gaEventAction') and Session.has('gaEventLabel') %}
ga('send', 'event', '{{Session.get('gaEventCategory')}}', '{{Session.get('gaEventAction')}}','{{ Session.get('gaEventLabel') }}');
{% endif %}
</script> </script>
</body> </body>