מאפייני משתמש מותאמים
מאפייני משתמש הם מאפיינים שמתארים את המשתמשים שלכם. השתמשו בהם כדי להתאים מסרים, ליצור סגמנטים ולנתח את קהל המשתמשים.
מה הם מאפייני משתמש?
מאפיינים הם זוגות מפתח־ערך שמצורפים לפרופיל משתמש:
{
"userId": "user_123",
"email": "john@example.com",
"attributes": {
"firstName": "John",
"lastName": "Doe",
"plan": "premium",
"signupDate": "2024-01-15",
"totalPurchases": 5,
"lastLoginDate": "2024-01-20",
"preferences": {
"newsletter": true,
"notifications": "email"
}
}
}
הגדרת מאפיינים
דרך SDK (צד הלקוח)
import JoryioSDK from '@joryio/web-sdk';
const joryio = new JoryioSDK({ sdkKey: 'jry_sdk_web_...' });
// Identify a user
joryio.identify('user_123');
// Set attributes separately
joryio.setAttributes({
email: 'john@example.com',
firstName: 'John',
lastName: 'Doe',
plan: 'premium',
signupDate: '2024-01-15'
});
// Update attributes later
joryio.setAttributes({
plan: 'enterprise',
lastUpgrade: new Date().toISOString()
});
דרך API (צד השרת)
// Create or update user with attributes
fetch('https://api-eu1.joryio.com/users', {
method: 'POST',
headers: {
'Authorization': 'Bearer jry_live_your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
userId: 'user_123',
email: 'john@example.com',
attributes: {
firstName: 'John',
plan: 'premium',
totalOrders: 10,
lifetime Value: 1250.00
}
})
});
מאפיינים סטנדרטיים לעומת מותאמים
מאפיינים סטנדרטיים
שמורים על ידי Joryio (נשמרים בשורש):
userId- מזהה משתמש ייחודיemail- כתובת אימיילphone- מספר טלפוןexternalId- מזהה במערכת חיצוניתcreatedAt- זמן יצירת משתמשupdatedAt- זמן עדכון אחרון
מאפיינים מותאמים
כל מאפיין אחר שתגדירו (נשמר באובייקט attributes):
firstName,lastName,nameplan,subscription Tiercompany,industry,jobTitletotalPurchases,lifetimeValuepreferences,settings- וכל דבר נוסף שאתם צריכים!
סוגי נתונים
מאפיינים תומכים בסוגי נתונים מרובים:
מחרוזת (String)
{
firstName: "John",
plan: "premium",
country: "US"
}
מספר (Number)
{
age: 30,
totalPurchases: 15,
lifetimeValue: 1250.50
}
בוליאני (Boolean)
{
emailVerified: true,
newsletter: false,
isPremium: true
}
תאריך/חותמת זמן
{
signupDate: "2024-01-15",
lastLoginDate: "2024-01-20T10:30:00Z",
trialEndsAt: "2024-02-15T23:59:59Z"
}
לתאריכים, השתמשו בפורמט ISO 8601: YYYY-MM-DDTHH:mm:ssZ
מערך (Array)
{
tags: ["vip", "early-adopter"],
interests: ["technology", "sports", "music"],
purchasedProducts: ["product_1", "product_2"]
}
אובייקט/מקונן
{
preferences: {
theme: "dark",
language: "en",
notifications: {
email: true,
sms: false,
push: true
}
},
address: {
street: "123 Main St",
city: "San Francisco",
state: "CA",
zip: "94102"
}
}
דוגמאות נפוצות למאפיינים
מסחר אלקטרוני
joryio.setAttributes({
// Account info
accountType: "premium",
memberSince: "2024-01-15",
// Purchase history
totalOrders: 15,
lastOrderDate: "2024-01-20",
lifetimeValue: 2500.00,
avgOrderValue: 166.67,
// Preferences
favoriteCategory: "electronics",
preferredShipping: "express",
// Engagement
cartAbandoned: false,
wishlistItems: 5,
reviewsWritten: 3
});
SaaS
joryio.setAttributes({
// Subscription
plan: "pro",
billingCycle: "monthly",
subscriptionStatus: "active",
trialEndsAt: "2024-02-15T23:59:59Z",
mrr: 99,
// Usage
loginCount: 45,
lastLoginDate: "2024-01-20",
featuresUsed: ["export", "api", "integrations"],
apiCallsThisMonth: 10500,
storageUsedGB: 15.5,
// Team
teamSize: 8,
role: "admin",
companyName: "Acme Corp"
});
מדיה/תוכן
joryio.setAttributes({
// Subscription
subscriptionTier: "premium",
contentAccessLevel: "unlimited",
// Engagement
articlesRead: 125,
videosWatched: 45,
podcastsListened: 30,
favoriteTopics: ["technology", "business"],
// Behavior
avgSessionDuration: 25.5,
lastVisit: "2024-01-20T14:30:00Z",
deviceType: "mobile"
});
עדכון מאפיינים
מיזוג לעומת החלפה
מיזוג (ברירת מחדל) - מעדכן שדות שצוינו:
// Initial attributes
{
firstName: "John",
plan: "free",
country: "US"
}
// Update attributes (merges with existing)
joryio.setAttributes({
plan: "premium"
});
// Result (plan updated, others preserved)
{
firstName: "John",
plan: "premium", // Updated
country: "US" // Preserved
}
קריאה ל־setAttributes() ממזגת מאפיינים חדשים עם קיימים. מאפיינים שלא צוינו נשמרים.
הגדלה/הפחתה
עבור מונים, הגדילו במקום לאחזר את הערך הנוכחי:
// Bad: Race condition possible
const current = await getUserAttribute('loginCount');
joryio.setAttributes({ loginCount: current + 1 });
// Good: Atomic increment
joryio.incrementAttribute('loginCount', 1);
// Decrement
joryio.incrementAttribute('creditsRemaining', -10);
מאפייני מערך
אפשר לשמור ולתפעל מערכים כערכי מאפיינים:
// Set array attribute
joryio.setAttributes({
tags: ['vip', 'early-adopter'],
interests: ['technology', 'sports']
});
// Add to array (only adds if value doesn't already exist)
joryio.addToArray('tags', 'premium');
// Result: ['vip', 'early-adopter', 'premium']
// Add duplicate (no-op, prevents duplicates)
joryio.addToArray('tags', 'vip');
// Result: ['vip', 'early-adopter', 'premium'] (unchanged)
// Remove from array
joryio.removeFromArray('tags', 'early-adopter');
// Result: ['vip', 'premium']
פרטי השיטות:
| שיטה | תיאור |
|---|---|
addToArray(key, value) | מוסיף ערך למערך אם הוא לא קיים (מונע כפילויות). יוצר מערך חדש אם המאפיין לא קיים. |
removeFromArray(key, value) | מסיר את כל המופעים של הערך מהמערך. מזהיר אם המאפיין אינו מערך. |
מאפייני מערך מתאימים ל:
- תגיות משתמשים:
['vip', 'trial', 'beta-tester'] - תחומי עניין:
['sports', 'technology', 'fashion'] - מוצרים שנרכשו:
['prod_123', 'prod_456'] - דגלי יכולות:
['feature-a', 'feature-b'] - תפקידים:
['admin', 'editor']
שימוש במאפיינים לסגמנטציה
צרו סגמנטים לפי מאפיינים:
מסנן מאפיין פשוט
plan equals "premium"
השוואה מספרית
lifetimeValue >= 1000
totalPurchases > 5
age between 25 and 45
מסננים לפי תאריך
signupDate is within last 30 days
trialEndsAt is within next 7 days
lastLoginDate is more than 14 days ago
התאמת מחרוזות
email contains "@company.com"
country equals "US"
firstName exists
plan is not "free"
מסנני מערך
tags contains "vip"
interests contains any of ["technology", "business"]
התאמה אישית של הודעות
השתמשו במאפיינים בתוכן קמפיינים:
התאמה אישית למייל
Hi {{firstName}},
Your {{plan}} plan includes these benefits:
...
{{#if trialEndsAt}}
Your trial ends on {{trialEndsAt}}. Upgrade now!
{{/if}}
תוכן דינמי
{{#if plan == "free"}}
<p>Upgrade to Premium for more features!</p>
{{else}}
<p>Thanks for being a {{plan}} member!</p>
{{/if}}
בלוקים מותנים
{{#if totalPurchases > 10}}
<div class="vip-offer">
As a valued customer, here's an exclusive offer...
</div>
{{/if}}
שיטות עבודה מומלצות למאפיינים
1. השתמשו בשמות תיאוריים
טוב:
{
subscriptionTier: "premium",
lifetimeValueUSD: 1250.00,
emailVerified: true
}
לא טוב:
{
sub: "p",
ltv: 1250,
verified: 1
}
2. היו עקביים
השתמשו באותה מוסכמה לשמות:
טוב (camelCase):
{
firstName: "John",
lastName: "Doe",
signupDate: "2024-01-15"
}
לא טוב (מעורב):
{
first_name: "John",
LastName: "Doe",
"signup-date": "2024-01-15"
}
3. השתמשו בסוגים מתאימים
טוב:
{
age: 30, // Number
isPremium: true, // Boolean
signupDate: "2024-01-15", // ISO Date String
tags: ["vip", "beta"] // Array
}
לא טוב:
{
age: "30", // String instead of number
isPremium: "true", // String instead of boolean
signupDate: 1705276800, // Timestamp instead of ISO
tags: "vip,beta" // String instead of array
}
4. אל תשמרו נתונים רגישים
לעולם אל תשמרו:
- סיסמאות או גיבובי סיסמאות
- מספרי כרטיס אשראי מלאים
- מספרי תעודת זהות
- פרטי בנק
- מידע רפואי
מותר לשמור:
- 4 ספרות אחרונות של כרטיס
- סוג אמצעי תשלום ("visa", "mastercard")
- טוקנים מוצפנים/מגובבים
- מידע פרופיל ציבורי
5. שמרו על שמות קצרים
טוב: plan, ltv, mrr
לא טוב: currentSubscriptionPlanTierLevel
שמות מאפיינים שמורים
הימנעו משימוש בשמות השמורים הבאים:
userId,user_id,idemailphonecreatedAt,created_atupdatedAt,updated_at$app_id,$platform(עם קידומת $)
עדכונים בכמות גדולה
עדכנו מאפיינים למספר משתמשים בבת אחת:
// API: Bulk update - POST /users accepts a bare array body (max 1000)
POST /users
[
{
"userId": "user_1",
"attributes": { "plan": "premium" }
},
{
"userId": "user_2",
"attributes": { "plan": "enterprise" }
}
]
מגבלות מאפיינים
| מגבלה | ערך |
|---|---|
| מקסימום מאפיינים למשתמש | 200 |
| אורך מקסימלי לשם מאפיין | 100 תווים |
| אורך מקסימלי לערך מחרוזת | 10,000 תווים |
| אורך מקסימלי למערך | 100 פריטים |
| עומק קינון מקסימלי | 5 רמות |
פתרון בעיות
מאפיינים לא מופיעים
- בדקו את איות שם המאפיין
- ודאו שהמשתמש עבר identify
- הפעילו מצב debug כדי לראות את קריאות ה-API
- בדקו שגיאות API בתגובה
מאפיין לא מתעדכן
- ודאו שאתם משתמשים במיזוג (לא בהחלפה)
- בדקו שסוג הנתונים תואם
- ודאו ששם המאפיין נכון
- בדקו את מגבלות הקצב (rate limits)
סגמנטציה לא עובדת
- ודאו שהמאפיין קיים אצל המשתמשים
- בדקו את סוג הנתונים של המאפיין
- בדקו את לוגיקת המסנן על משתמשים מוכרים
- ודאו שערכי המאפיין תואמים למסנן במדויק