Login
When to Use
The login
event should be triggered when existing users successfully authenticate and access their accounts, enabling user engagement tracking and session analytics optimization.
Standard Authentication
When users successfully log in using email/username and password combinations through your standard authentication system.
Social Media Login
When users authenticate using social media platforms like Google, Facebook, LinkedIn, or other OAuth providers for quick access.
Single Sign-On (SSO)
When users access your platform through enterprise SSO systems, SAML authentication, or federated identity providers.
Two-Factor Authentication
When users complete multi-factor authentication processes including SMS codes, authenticator apps, or biometric verification.
Session Recovery
When users are automatically logged in through remember me functionality, persistent sessions, or token-based authentication.
Complete Reference
event object required
name string required
Use only static value login for `event.name'.
name: "login"
value number recommended
Event value in decimal format.
Represent the estimated session value or user engagement value for analytics purposes.
value: 10.00
currency string required
Currency code that specifies the currency in which all monetary values from any object associated with this event are expressed.
Note: This value can be overridden in nested objects if they contain their own value
key with a currency specified.
currency: "USD"
exchange_rate number
Custom exchange rate for multi-currency. Default has value 1.
Note: This value can be overridden in nested objects if they contain their own value key with a currency specified.
exchange_rate: 1
id string required
Event ID — required for any actions that require deduplication or uniqueness. Represents the unique identifier of an action ID used in your system.
id: "UNIQUE_LOGIN_SESSION_ID_123"
context object
Use only if exists new data. View complete Context Object documentation
url string required-if-applicable
Complete URL of the current page including all parameters
SPA Applications: context.url
is particularly valuable for Single Page Applications where URL changes don’t automatically trigger page context updates. Manual implementation ensures accurate tracking of page transitions and user navigation within SPA frameworks.
url:"https://shop.example.com/products/laptop?color=silver&storage=512gb&utm_source=google"
URL Parameter Sensitivity: Be mindful of sensitive information in URLs. Query parameters may contain personal identifiers, session tokens, or private information that should be handled according to privacy regulations.
page_type string recommended
Type of page (product, home ...)
page_type: "product"
environment string recommended
Allowed values: prod, dev
environment: "prod"
user object required
id string recommended
Unique customer identifier in your system.
id: "CUSTOMER_INTERNAL_ID"
email string|array recommended
Customer email address(es) provided in plaintext or as SHA-256 hashed values.
email: "[email protected]"
// or
email: ["[email protected]", "[email protected]"]
// or
email: ["3e1ufd1rdnh8l1rfz6xlreyw2yryd4zrf8zsk1pxh2x8wbsp2mw1g93rs5nx68dq"]
phone string|array recommended
Customer phone number(s) in E.164 format (plaintext) or as SHA-256 hashed values.
phone: "+40712345678"
// or
phone: ["+40712345678", "+4079876543"]
// or
phone: ["unw5r66oikql4n4tlg2c54bkd2npephsbwwhxuoxreu6ph8uv6k424y9x15opy9y"]
first_name string recommended
Customer first name
first_name: "John"
last_name string recommended
Customer last name
last_name: "Doe"
country string
Country name or ISO country code
country: "Romania"
region string recommended
State, province, or region name
region: "Bucuresti"
city string recommended
City or locality name
city: "Bucuresti"
street string
Street address including number
street: "Strada Principala 1"
postal_code string
Postal code or ZIP code
postal_code: "700000"
orders_total_number number recommended
Cumulative number of orders placed by this user
orders_total_number: 5
orders_canceled_number number recommended
Cumulative number of orders placed and canceled by this user
orders_canceled_number: 0
orders_total_value number recommended
Cumulative lifetime user orders value (decimal format: 2500.50)
orders_total_value: 1234.99
orders_refunded_value number recommended
Cumulative lifetime user orders value canceled (decimal format: 2500.50)
orders_refunded_value: 250.99
predicted_value number
Predicted lifetime value of a customer for your business
predicted_value: 100.99
created_at number recommended
Timestamp in milliseconds since Unix epoch representing the first time the user was recorded
created_at: 1754926521690
properties object recommended
Custom Customer Properties Examples
Use the properties
object to store custom user attributes, with property names defined by each business as needed, that enable advanced segmentation, personalization, and analytics across your marketing campaigns.
- E-commerce Customer
- B2B Lead/Customer
- Subscription Service
- Content Platform
properties: {
customer_type: "returning",
membership_level: "platinum",
preferred_category: ["electronics", "fashion"],
last_purchase_date: "2024-12-15",
average_order_value: "350.00",
payment_method_preference: "card",
registration_date: "2023-06-15"
}
properties: {
company_size: "enterprise",
industry: "fintech",
job_title: "marketing_director",
decision_maker: "true",
budget_range: "50000-100000",
lead_source: ["linkedin", "webinar"],
qualification_status: "qualified",
sales_stage: "proposal"
}
properties: {
subscription_tier: "premium",
billing_cycle: "annual",
feature_usage: ["analytics", "reporting", "api"],
trial_user: "false",
renewal_date: "2025-06-30",
support_level: "priority",
usage_frequency: "daily"
}
properties: {
content_preferences: ["technology", "business"],
engagement_level: "high",
newsletter_subscriber: "true",
social_media_follower: "true",
content_consumption: "premium",
device_preference: ["mobile", "desktop"],
timezone: "Europe/Bucharest"
}
properties object recommended
Custom Event Properties Examples
- Order canceled
- B2B Lead
- Subscription Service
properties: {
cancel_reason: "returning",
}
properties: {
lead_status: "converted",
sales_stage: "proposal"
}
properties: {
subscription_tier: "premium",
billing_cycle: "annual",
trial_user: "false",
renewal_date: "2025-06-30",
support_level: "priority",
usage_frequency: "daily"
}
Object Examples
These examples demonstrate the complete data object structure for the login
event. Use the complete example for detailed implementations or the minimal example for quick integrations.
- Complete Example
- Minimal Example
{
"event": {
"name": "login",
"value": 15.00,
"currency": "USD",
"exchange_rate": 1,
"id": "LOGIN_SESSION_789",
"properties": {
"authentication_method": "email_password",
"login_duration_seconds": 3.2,
"failed_attempts_before_success": 0,
"two_factor_enabled": true,
"remember_me_selected": true,
"session_type": "web_browser",
"previous_login_days_ago": 2,
"account_status": "active",
"login_location_new": false,
"security_alerts_triggered": false
}
},
"context": {
"environment": "prod",
"data_source": "website",
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
"overide_ip": "203.0.113.195",
"url": "https://app.example.com/dashboard",
"landing_url": "https://example.com/login",
"referring_url": "https://google.com/search"
},
"user": {
"id": "USER_654321",
"email": ["[email protected]"],
"phone": ["+1555888999"],
"first_name": "Amanda",
"last_name": "Williams",
"country": "United Kingdom",
"region": "England",
"city": "Manchester",
"street": "890 Digital Street, Unit 7B",
"postal_code": "M1 1AA",
"properties": {
"account_created_date": "2023-08-15",
"subscription_plan": "professional",
"last_login_date": "2024-08-12",
"login_frequency": "daily",
"preferred_language": "en",
"timezone": "Europe/London",
"device_preference": "desktop",
"user_role": "admin",
"feature_usage_level": "advanced",
"support_tier": "priority"
}
}usage_level": "advanced",
"support_tier": "priority"
}
}
}
{
"event": {
"name": "login",
"value": 5.00,
"currency": "USD",
"id": "LOGIN_MIN_456"
},
"context": {
"environment": "prod",
"data_source": "mobile_app"
},
"user": {
"id": "USER_987654",
"email": ["[email protected]"],
"first_name": "Chris",
"last_name": "Thompson",
"country": "Australia"
}
}
Implementation Methods
These examples show how to send the data objects using different implementation approaches. Choose the method that best fits your technical setup.
- JavaScript Implementation
- API Implementation
// Web tracking implementation
window.reshape = window.reshape || [];
// Send the complete data object
reshape.push({
"event": {
"name": "login",
"value": 15.00,
"currency": "USD",
"id": "LOGIN_SESSION_789"
},
"context": {
"environment": "prod",
"data_source": "website"
},
"user": {
"id": "USER_654321",
"email": ["[email protected]"]
}
});
# Define the JSON body as a variable
BODY_JSON='{
"event": {
"name": "login",
"value": 15.00,
"currency": "USD",
"id": "LOGIN_SESSION_789"
},
"context": {
"environment": "prod",
"data_source": "website"
},
"user": {
"id": "USER_654321",
"email": ["[email protected]"]
}
}'
# Send the request using curl
curl -X POST "https://dre2.yourdomain.com/reshape/standard/event?id=YOUR_SCRIPT_ID" \
-H "Content-Type: application/json" \
-H "X-Dre-Access-Token: YOUR_ACCESS_TOKEN" \
-d "$BODY_JSON"