utm tracking in db (#574)

* utm tracking in db

* fix array key bug
This commit is contained in:
Favour Olayinka
2024-09-18 17:50:04 +01:00
committed by GitHub
parent 7f6c21408c
commit a057045ef6
8 changed files with 44 additions and 1 deletions

View File

@@ -53,6 +53,7 @@ class OAuthController extends Controller
"message" => "OAuth service failed to authenticate: " . $e->getMessage()
]);
}
$user = $this->findOrCreateUser($provider, $driverUser);
if (!$user) {
@@ -116,6 +117,7 @@ class OAuthController extends Controller
'name' => $socialiteUser->getName(),
'email' => $email,
'email_verified_at' => now(),
'utm_data' => json_decode(request()->utm_data, true)
]);
// Create and sync workspace

View File

@@ -64,6 +64,7 @@ class RegisterController extends Controller
'agree_terms' => ['required', Rule::in([true])],
'appsumo_license' => ['nullable'],
'invite_token' => ['nullable', 'string'],
'utm_data' => ['nullable', 'array']
], [
'agree_terms' => 'Please agree with the terms and conditions.',
]);
@@ -82,6 +83,7 @@ class RegisterController extends Controller
'email' => strtolower($data['email']),
'password' => bcrypt($data['password']),
'hear_about_us' => $data['hear_about_us'],
'utm_data' => array_key_exists('utm_data', $data) ? $data['utm_data'] : null,
]);
// Add relation with user