User Object
Overview
The user object contains detailed information about customers and visitors as they interact with your website or application, enabling comprehensive user identification, personalization, and analytics. This object plays a crucial role in understanding visitor behavior, preferences, and engagement patterns while supporting compliance with data privacy regulations through automatic hashing and anonymization features.
Each user object represents a single customer or visitor with their associated contact information, demographic details, order history, and custom properties that enable precise user segmentation and personalized experiences across all touchpoints.
Core Structure
The user object consists of several logical groups of properties:
- Core Identification - Essential user IDs and contact information
- Personal Information - Names and demographic details
- Location Data - Address and geographic information
- Order History - Purchase behavior and lifetime value metrics
- Custom Properties - Flexible attributes for business-specific segmentation
Complete Reference
user object
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"
}
Implementation Examples
- E-commerce Customer
- B2B Lead
- Privacy-Compliant
- Minimal Implementation
{
// Customer identification
id: "CUST_ECOM_12345",
email: ["[email protected]", "[email protected]"],
phone: ["+1555123456", "+1555987654"],
first_name: "Sarah",
last_name: "Johnson",
// Location information
country: "United States",
region: "California",
city: "San Francisco",
street: "123 Market Street, Apt 4B",
postal_code: "94105",
// Purchase history
orders_total_number: 8,
orders_canceled_number: 1,
orders_total_value: 2156.75,
orders_refunded_value: 299.99,
predicted_value: 3500.00,
created_at: 1640995200000,
// Customer segmentation
properties: {
customer_segment: "loyal",
acquisition_channel: "paid_search",
preferred_categories: ["electronics", "home_garden"],
loyalty_tier: "gold",
marketing_consent: true,
preferred_payment_method: "credit_card",
average_order_value: 269.59,
purchase_frequency: "quarterly"
}
}
{
// Lead identification
id: "LEAD_B2B_67890",
email: ["[email protected]"],
phone: ["+1555234567"],
first_name: "David",
last_name: "Smith",
// Company location
country: "United States",
region: "New York",
city: "New York",
street: "456 Broadway, Suite 1200",
postal_code: "10013",
// Lead metrics
orders_total_number: 0,
orders_canceled_number: 0,
orders_total_value: 0.00,
orders_refunded_value: 0.00,
predicted_value: 15000.00,
created_at: 1704067200000,
// B2B properties
properties: {
company: "TechCorp Solutions",
job_title: "IT Director",
company_size: "100-500",
industry: "technology",
lead_source: "webinar",
lead_score: 85,
budget_range: "10k-50k",
decision_timeline: "next_quarter",
pain_points: ["scalability", "security"]
}
}
{
// Hashed personal information for privacy
id: "CUST_PRIVATE_11111",
email: ["3e1ufd1rdnh8l1rfz6xlreyw2yryd4zrf8zsk1pxh2x8wbsp2mw1g93rs5nx68dq"],
phone: ["unw5r66oikql4n4tlg2c54bkd2npephsbwwhxuoxreu6ph8uv6k424y9x15opy9y"],
// Names can be omitted for additional privacy
// General location (no specific address)
country: "Germany",
region: "Bavaria",
city: "Munich",
// Anonymous analytics data
orders_total_number: 3,
orders_canceled_number: 0,
orders_total_value: 567.50,
orders_refunded_value: 0.00,
predicted_value: 800.00,
created_at: 1672531200000,
// Privacy-safe properties
properties: {
customer_segment: "new",
acquisition_channel: "organic",
communication_language: "de",
marketing_consent: false,
cookie_consent: "essential_only"
}
}
{
// Minimal required user data
id: "CUST_MIN_99999",
email: "[email protected]",
first_name: "Alex",
last_name: "Brown",
country: "Canada"
}
Contact Information Strategies
The user object supports multiple formats for contact information to ensure maximum compatibility and privacy options:
- Multiple Contact Methods
- Hashed for Privacy
- Mixed Format
{
id: "CUST_MULTI_001",
// Multiple email addresses
email: [
"[email protected]", // Primary email
"[email protected]", // Work email
"[email protected]" // Alternative email
],
// Multiple phone numbers
phone: [
"+1555123456", // Primary phone
"+1555987654" // Alternative phone
],
first_name: "Jennifer",
last_name: "Wilson"
}
{
id: "CUST_HASH_001",
// SHA-256 hashed email addresses
email: [
"3e1ufd1rdnh8l1rfz6xlreyw2yryd4zrf8zsk1pxh2x8wbsp2mw1g93rs5nx68dq",
"7f2c8e4a9b3d1f6e8c5a2d9b7e4f1a3c6e9d2b5f8a1e4c7b0d3f6a9c2e5b8d1"
],
// SHA-256 hashed phone numbers
phone: [
"unw5r66oikql4n4tlg2c54bkd2npephsbwwhxuoxreu6ph8uv6k424y9x15opy9y"
]
}
{
id: "CUST_MIXED_001",
// Combination of plaintext and hashed
email: [
"[email protected]", // Plaintext
"3e1ufd1rdnh8l1rfz6xlreyw2yryd4zrf8zsk1pxh2x8wbsp2mw1g93rs5nx68dq" // Hashed
],
phone: ["+1555123456"], // Plaintext phone
first_name: "Michael",
last_name: "Davis"
}
Customer Lifecycle Tracking
The user object enables comprehensive customer lifecycle analysis through order history and value metrics:
- New Customer
- Loyal Customer
- At-Risk Customer
{
id: "CUST_NEW_001",
email: ["[email protected]"],
first_name: "Emma",
last_name: "Thompson",
// New customer metrics
orders_total_number: 1,
orders_canceled_number: 0,
orders_total_value: 89.99,
orders_refunded_value: 0.00,
predicted_value: 450.00,
created_at: 1704067200000, // Recent creation date
properties: {
customer_segment: "new",
acquisition_channel: "social_media",
first_purchase_category: "fashion",
onboarding_completed: true,
newsletter_subscribed: true
}
}
{
id: "CUST_LOYAL_001",
email: ["[email protected]"],
first_name: "Robert",
last_name: "Martinez",
// Established customer metrics
orders_total_number: 25,
orders_canceled_number: 2,
orders_total_value: 4567.89,
orders_refunded_value: 234.50,
predicted_value: 7500.00,
created_at: 1609459200000, // Long-term customer
properties: {
customer_segment: "vip",
loyalty_tier: "platinum",
average_order_value: 182.72,
purchase_frequency: "monthly",
referral_count: 3,
lifetime_discount_used: 456.78
}
}
{
id: "CUST_RISK_001",
email: ["[email protected]"],
first_name: "Lisa",
last_name: "Anderson",
// At-risk customer indicators
orders_total_number: 8,
orders_canceled_number: 3,
orders_total_value: 1234.56,
orders_refunded_value: 456.78,
predicted_value: 200.00, // Lower predicted value
created_at: 1640995200000,
properties: {
customer_segment: "at_risk",
last_purchase_days_ago: 180,
support_tickets: 4,
satisfaction_score: 2.5,
churn_probability: "high",
retention_campaign_sent: true
}
}
Geographic and Demographic Segmentation
European Customer Examples
- German Customer
- French Customer
- Romanian Customer
{
id: "CUST_DE_001",
email: ["[email protected]"],
first_name: "Hans",
last_name: "Mueller",
// German location
country: "Germany",
region: "Baden-Württemberg",
city: "Stuttgart",
street: "Königstraße 123",
postal_code: "70173",
properties: {
communication_language: "de",
currency_preference: "EUR",
gdpr_consent: true,
marketing_consent: false,
timezone: "Europe/Berlin",
vat_exempt: false
}
}
{
id: "CUST_FR_001",
email: ["[email protected]"],
first_name: "Marie",
last_name: "Dubois",
// French location
country: "France",
region: "Île-de-France",
city: "Paris",
street: "123 Avenue des Champs-Élysées",
postal_code: "75008",
properties: {
communication_language: "fr",
currency_preference: "EUR",
gdpr_consent: true,
marketing_consent: true,
timezone: "Europe/Paris",
vat_exempt: false
}
}
{
id: "CUST_RO_001",
email: ["[email protected]"],
first_name: "Alexandru",
last_name: "Popescu",
// Romanian location
country: "Romania",
region: "Brașov",
city: "Brașov",
street: "Strada Republicii 45",
postal_code: "500030",
properties: {
communication_language: "ro",
currency_preference: "RON",
gdpr_consent: true,
marketing_consent: true,
timezone: "Europe/Bucharest",
vat_exempt: false
}
}
Custom Properties Strategy
User properties enable powerful segmentation and personalization capabilities:
- Behavioral Properties
- Business Properties
- Demographic Properties
properties: {
// Shopping behavior
browsing_pattern: "research_heavy",
cart_abandonment_rate: 0.25,
price_sensitivity: "medium",
seasonal_shopper: true,
// Engagement metrics
email_open_rate: 0.45,
social_media_follower: true,
review_contributor: true,
referral_program_member: true,
// Preferences
preferred_contact_method: "email",
notification_frequency: "weekly",
content_preference: ["video", "articles"],
device_preference: "mobile"
}
properties: {
// B2B specific
company: "Enterprise Solutions Inc",
job_title: "Chief Technology Officer",
department: "IT",
company_size: "1000+",
industry: "financial_services",
// Decision making
decision_maker: true,
budget_authority: "50k+",
procurement_process: "formal_rfp",
evaluation_stage: "vendor_comparison",
// Account details
account_type: "enterprise",
contract_type: "annual",
support_tier: "premium",
implementation_complexity: "high"
}
properties: {
// Demographics
age_range: "35-44",
gender: "female",
income_range: "75k-100k",
education_level: "masters_degree",
occupation: "marketing_manager",
// Lifestyle
family_status: "married_with_children",
homeowner: true,
urban_suburban: "suburban",
interests: ["fitness", "travel", "technology"],
// Purchase drivers
value_conscious: true,
brand_loyal: false,
early_adopter: true,
sustainability_focused: true
}
Privacy and Compliance Features
Automatic Data Protection
The user object includes built-in privacy protection:
// Data is automatically hashed with SHA-256
{
email: "[email protected]",
// Becomes: "3e1ufd1rdnh8l1rfz6xlreyw2yryd4zrf8zsk1pxh2x8wbsp2mw1g93rs5nx68dq"
phone: "+1555123456",
// Becomes: "unw5r66oikql4n4tlg2c54bkd2npephsbwwhxuoxreu6ph8uv6k424y9x15opy9y"
}
Consent Management Integration
{
id: "CUST_CONSENT_001",
email: ["[email protected]"],
properties: {
// Consent tracking
gdpr_consent: true,
marketing_consent: false,
analytics_consent: true,
cookie_consent: "essential_only",
consent_date: "2024-01-15",
// Privacy preferences
data_retention_period: "2_years",
right_to_be_forgotten: false,
data_portability_requested: false,
communication_opt_out: ["sms", "phone"]
}
}
Usage in Events
The user object is used across all event types for identification and personalization:
- E-commerce Events - Customer attribution and purchase behavior
- Lead Generation - Prospect identification and qualification
- User Engagement - Personalization and content optimization
- Marketing Campaigns - Attribution and campaign effectiveness
Integration Patterns
Progressive Data Collection
// Initial anonymous visitor
{
id: "ANON_12345",
properties: {
visitor_type: "anonymous",
session_count: 1,
pages_viewed: 3
}
}
// After email capture
{
id: "ANON_12345",
email: ["[email protected]"],
properties: {
visitor_type: "identified",
lead_source: "newsletter_signup",
session_count: 1
}
}
// After first purchase
{
id: "CUST_12345", // Updated ID
email: ["[email protected]"],
first_name: "John",
last_name: "Doe",
orders_total_number: 1,
orders_total_value: 89.99,
properties: {
customer_segment: "new",
acquisition_channel: "email_marketing"
}
}
Best Practices
Data Quality
- Consistent Identification - Use stable user IDs across all events and sessions
- Complete Contact Information - Provide multiple contact methods when available
- Accurate Order History - Maintain up-to-date purchase and value metrics
- Relevant Properties - Include properties that enable meaningful segmentation
Privacy Compliance
- Consent Management - Respect user privacy preferences and consent status
- Data Minimization - Collect only necessary information for business purposes
- Secure Transmission - Always use HTTPS for transmitting user data
- Regular Audits - Monitor data collection practices for compliance
Performance Optimization
- Essential Data First - Prioritize critical identification fields
- Incremental Enhancement - Add additional data as it becomes available
- Property Standardization - Use consistent naming for custom properties
- Data Validation - Ensure email and phone number formats are correct
Customer Experience
- Personalization - Use customer data to improve user experience
- Segmentation Strategy - Group customers for targeted marketing
- Lifecycle Tracking - Monitor customer journey and value progression
- Preference Management - Honor customer communication and privacy preferences