From c36eec5441d481a285ba526eb13a9676cf0ece16 Mon Sep 17 00:00:00 2001 From: Nicola Lanzilotto Date: Fri, 6 Oct 2023 13:36:43 +0200 Subject: [PATCH] Tracks --- src/app/auth/signin/signin.component.ts | 4 +++- src/app/auth/signup/signup.component.ts | 2 ++ .../bots/templates/templates.component.html | 6 +++++- src/app/components/navbar/navbar.component.ts | 21 ++++++++++++++++++- src/app/core/auth.service.ts | 5 +++-- .../home-create-chatbot.component.ts | 5 +++-- .../home-whatsapp-account.component.html | 10 ++++----- src/app/home/home.component.ts | 10 ++++++--- 8 files changed, 48 insertions(+), 15 deletions(-) diff --git a/src/app/auth/signin/signin.component.ts b/src/app/auth/signin/signin.component.ts index 32be488d86b0..9c89c2a501e1 100755 --- a/src/app/auth/signin/signin.component.ts +++ b/src/app/auth/signin/signin.component.ts @@ -275,6 +275,7 @@ export class SigninComponent implements OnInit { this.logger.log('[SIGN-IN] email ', this.userForm.value['email']) this.auth.signin(this.userForm.value['email'], this.userForm.value['password'], this.appConfigService.getConfig().SERVER_BASE_URL, (error, user) => { if (!error) { + // this.localDbService.removeFromStorage('signedup') // console.log('[SIGN-IN] SSO (Signin) - user', user); // this.localDbService.removeFromStorage('hpea'); if (!isDevMode()) { @@ -308,7 +309,8 @@ export class SigninComponent implements OnInit { try { window['analytics'].track('Signed In', { "username": userFullname, - "userId": user._id + "userId": user._id, + 'method': "Email and Password" }); } catch (err) { this.logger.error('track signin event error', err); diff --git a/src/app/auth/signup/signup.component.ts b/src/app/auth/signup/signup.component.ts index add39178c47a..6591961ffcff 100755 --- a/src/app/auth/signup/signup.component.ts +++ b/src/app/auth/signup/signup.component.ts @@ -504,6 +504,8 @@ export class SignupComponent implements OnInit, AfterViewInit { this.logger.log('[SIGN-UP] Lastname ', this.userForm.value['lastName']); this.logger.log('[SIGN-UP] POST DATA ', signupResponse); if (signupResponse['success'] === true) { + + // this.localDbService.setInStorage('signedup', 'true') // this.router.navigate(['/welcome']); this.logger.log('[SIGN-UP] RES ', signupResponse); const userEmail = signupResponse.user.email diff --git a/src/app/bots/templates/templates.component.html b/src/app/bots/templates/templates.component.html index 9ecf5379a983..7edb3fb1392e 100644 --- a/src/app/bots/templates/templates.component.html +++ b/src/app/bots/templates/templates.component.html @@ -522,7 +522,7 @@

+ *ngFor="let tag of template.tags | slice:0:3; let i=index">
@@ -539,6 +539,10 @@

+ +
+
+ + {{ template?.tags?.length - 3 }}
diff --git a/src/app/components/navbar/navbar.component.ts b/src/app/components/navbar/navbar.component.ts index 2879387336eb..0b960608e36a 100755 --- a/src/app/components/navbar/navbar.component.ts +++ b/src/app/components/navbar/navbar.component.ts @@ -570,7 +570,7 @@ export class NavbarComponent implements OnInit, AfterViewInit, AfterContentCheck this.router.events .subscribe((event: NavigationEvent) => { if (event instanceof NavigationEnd) { - // console.log('[NAVBAR] NavigationEnd ', event.url); + console.log('[NAVBAR] NavigationEnd ', event.url); /** HIDE THE PLAN NAME IF THE ROUTE ACTIVE IS THE HOME */ if (event.url.indexOf('/home') !== -1) { @@ -616,6 +616,7 @@ export class NavbarComponent implements OnInit, AfterViewInit, AfterContentCheck this.router.events.subscribe((val) => { + if (this.location.path() !== '') { this.route = this.location.path(); // this.logger.log('»> »> »> NAVBAR ROUTE DETECTED »> ', this.route) @@ -648,6 +649,22 @@ export class NavbarComponent implements OnInit, AfterViewInit, AfterContentCheck // this.logger.log('»> »> »> NAVBAR ROUTE DETECTED »> ', this.route, 'HIDE PENDING_EMAIL_NOTIFICATION ', this.HIDE_PENDING_EMAIL_NOTIFICATION) } + // const navigationEndVal = val instanceof NavigationEnd + // console.log('[NAVBAR] navigationEndVal ' ,navigationEndVal ) + + // if (navigationEndVal) { + // const hasSignedup = this.localDbService.getFromStorage('signedup') + // console.log('[NAVBAR] hasSignedup ', hasSignedup) + // if (hasSignedup) { + // this.HIDE_PENDING_EMAIL_NOTIFICATION = true; + + // console.log('[NAVBAR] HIDE_PENDING_EMAIL_NOTIFICATION ' ,this.HIDE_PENDING_EMAIL_NOTIFICATION ) + // } + // } + + + + // if (this.route === '/login') { // this.logger.log('»> »> »> NAVBAR ROUTE DETECTED »> ', this.route) // // this.DETECTED_LOGIN_PAGE = true; @@ -667,6 +684,8 @@ export class NavbarComponent implements OnInit, AfterViewInit, AfterContentCheck // } } }); + + } /** diff --git a/src/app/core/auth.service.ts b/src/app/core/auth.service.ts index e2c88e3d0d02..d889b476fb64 100755 --- a/src/app/core/auth.service.ts +++ b/src/app/core/auth.service.ts @@ -1369,9 +1369,10 @@ export class AuthService { } // Segments try { - window['analytics'].track('Signed In Sign in with Google', { + window['analytics'].track('Signed In', { "username": userFullname, - "userId": user._id + "userId": user._id, + 'method': "Sign in with Google" }); } catch (err) { this.logger.error('track Sign in with Google event error', err); diff --git a/src/app/home-components/home-create-chatbot/home-create-chatbot.component.ts b/src/app/home-components/home-create-chatbot/home-create-chatbot.component.ts index 51ea2941a4a7..342a12b85a60 100644 --- a/src/app/home-components/home-create-chatbot/home-create-chatbot.component.ts +++ b/src/app/home-components/home-create-chatbot/home-create-chatbot.component.ts @@ -354,18 +354,19 @@ export class HomeCreateChatbotComponent implements OnInit, OnChanges { } else if (this.use_case_for_child === 'increase_online_sales') { this.router.navigate(['project/' + this.projectId + '/bots/templates/increase-sales']); } else if (this.use_case_for_child === undefined) { + this.trackUserAction.emit({action:'Explore Templates', actionRes: 'All' }) this.router.navigate(['project/' + this.projectId + '/bots/templates/all']); } localStorage.setItem('wawizard', 'hookbot') } goToIncreaseSalesTemplates() { - // this.trackUserAction.emit({action:'Home', actionRes: 'Explore Increase Sales Templates' }) + this.trackUserAction.emit({action:'Explore Templates', actionRes: 'Increase Sales' }) this.router.navigate(['project/' + this.projectId + '/bots/templates/increase-sales']); } goToCustomerSatisfactionTemplates() { - // this.trackUserAction.emit({action:'Home',actionRes: 'Explore Customer Satisfaction Templates' }) + this.trackUserAction.emit({action:'Explore Templates', actionRes: 'Customer Satisfaction' }) this.router.navigate(['project/' + this.projectId + '/bots/templates/customer-satisfaction']); } diff --git a/src/app/home-components/home-whatsapp-account/home-whatsapp-account.component.html b/src/app/home-components/home-whatsapp-account/home-whatsapp-account.component.html index f14793c1b00f..3fd38e2a44c0 100644 --- a/src/app/home-components/home-whatsapp-account/home-whatsapp-account.component.html +++ b/src/app/home-components/home-whatsapp-account/home-whatsapp-account.component.html @@ -77,16 +77,16 @@
Connect your WhatsApp Business to organize your campaign and to easily receive and reply to WhatsApp messages from the Tiledesk chat - Display the wizard to connect WhatsApp - + -->
- whatsAppIsInstalled > {{whatsAppIsInstalled }} - whatsAppIsConnected > {{whatsAppIsConnected }} +
diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 37950dd6783b..dd2dd06523ef 100755 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -630,8 +630,8 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { this.logger.log('[HOME] - trackUserAction ', event); const userAction = event.action const userActionRes = event.actionRes - this.logger.log('[HOME] - trackUserAction userAction', userAction); - this.logger.log('[HOME] - trackUserAction userActionRes', userActionRes); + console.log('[HOME] - trackUserAction userAction', userAction); + console.log('[HOME] - trackUserAction userActionRes', userActionRes); const trackObjct = { "type": "organic", "username": userFullname, @@ -663,7 +663,11 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit { trackObjct['button'] = "Connect" } - this.logger.log('[HOME] - trackUserAction trackObjct', trackObjct); + if (userAction === 'Explore Templates' && userActionRes !== null) { + trackObjct['category'] = userActionRes + } + + console.log('[HOME] - trackUserAction trackObjct', trackObjct); if (!isDevMode()) { try { window['analytics'].track(userAction, trackObjct);