File size: 3,260 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Login Analytics Events

This document outlines all the analytics events tracked during the login process, particularly for magic login flows.

## Magic Login Authentication Events

### `calypso_login_magic_authenticate_attempt`
**Description**: Tracks when a magic login authentication is attempted (either code or link)

**Properties**:
- `flow` (string|null): The client's login flow (e.g., gravatar flows)
- `token_type` (string): Either "code" or "link"

### `calypso_login_magic_authenticate_success`
**Description**: Tracks successful magic login authentication

**Properties**:
- `flow` (string|null): The client's login flow
- `token_type` (string): Either "code" or "link"

### `calypso_login_magic_authenticate_failure`
**Description**: Tracks failed magic login authentication attempts

**Properties**:
- `flow` (string|null): The client's login flow
- `token_type` (string): Either "code" or "link"
- `error_code` (number): HTTP status code of the error
- `error_message` (string): Error type/message

## Magic Code Verification Events

### `calypso_login_magic_code_submit`
**Description**: Tracks when user submits a magic code for verification

**Properties**:
- `code_length` (number): Length of the submitted verification code

## Email Link Events

### `calypso_login_email_link_submit`
**Description**: Tracks when user requests a magic login email

**Properties**:
- `flow` (string|null): The client's login flow
- `token_type` (string): Token type being requested

### `calypso_login_email_link_success`
**Description**: Tracks successful email link request

**Properties**:
- `flow` (string|null): The client's login flow
- `token_type` (string): Token type that was requested

### `calypso_login_email_link_failure`
**Description**: Tracks failed email link requests

**Properties**:
- `flow` (string|null): The client's login flow
- `token_type` (string): Token type that was requested
- `error_code` (string): Error code from the API
- `error_message` (string): Error message from the API

### `calypso_login_email_link_handle_click_view`
**Description**: Tracks when user views the email link handling page

**Properties**: None

## General Login Events

### `calypso_login_success`
**Description**: Tracks overall successful login completion

**Properties**:
- `is_jetpack` (boolean): Whether this is a Jetpack login
- `is_magic_login` (boolean): Whether magic login was used
- `login_method` (string): The method used for login

## Event Flow

1. **Email Request**: `calypso_login_email_link_submit``calypso_login_email_link_success`/`calypso_login_email_link_failure`
2. **Link Click**: `calypso_login_email_link_handle_click_view`
3. **Code Entry** (if applicable): `calypso_login_magic_code_submit`
4. **Authentication**: `calypso_login_magic_authenticate_attempt``calypso_login_magic_authenticate_success`/`calypso_login_magic_authenticate_failure`
5. **Final Success**: `calypso_login_success`

## Implementation Files

- **Email requests**: `client/state/data-layer/wpcom/auth/send-login-email/index.js`
- **Authentication**: `client/state/login/magic-login/actions.js`
- **Code verification**: `client/login/magic-login/verify-login-code.jsx`
- **Final login**: `client/state/login/actions/reboot-after-login.ts`