When working with Adobe Target, understanding profile scripts is essential for tracking user behavior, storing preferences, and customizing experiences. However, many users get confused between profile and user when writing profile scripts.
In this blog post, we’ll break down the differences between profile and user, their use cases, and how you can leverage both for effective personalization.
What’s the Difference Between profile and user?
Feature profile user
Scope | Stores persistent user data (across sessions & visits). | Retrieves real-time session-specific data. |
Persistence | Data is stored permanently unless reset or expired. | Data is only available during the session. |
Usage | Used for tracking user history, preferences, and behavior over time. | Used for fetching live details like IP, referrer, and user-agent. |
Example Methods | profile.set(), profile.get(), profile.increment(), profile.expireIn() | user.header(), user.device(), user.ipAddress(), user.referrer() |
Common Use Cases | Counting visits, storing user categories, tracking preferences. | Detecting current device, location, or referrer. |
When Should You Use profile vs user?
Scenario | Use profile | Use user |
Track how many times a user visited the website | Yes | No |
Store the last visited category | Yes | No |
Get the user's current device type | No | Yes |
Detect if a user came from Google search | No | Yes |
Show a popup after 4 visits to a product page (PDP) | Yes | No |
Get the user’s IP address | No | Yes |
Store a discount code that expires in 7 days | Yes | No |
Understanding when to use profile vs user ensures that data is stored and retrieved efficiently for better personalization.
Examples of profile and user in Adobe Target
Using profile for Persistent Tracking
Example: Counting the number of visits
var count = profile.get('visitCount') || 0;
count++;
profile.set('visitCount', count);
return count;
This persists across sessions—next time the user returns, the count continues.
Using user for Real-Time Data
Example: Checking if the user is on iOS
if (user.device().os === 'iOS') {
return 'iPhone/iPad User';
}
return 'Other Device';
This only applies to the current session—doesn’t store anything for future visits.
Key Takeaways
Use profile for long-term user data tracking (e.g., visit counts, preferences).
Use user for real-time session-based information (e.g., device, IP, referrer).
You can combine both. Example: Store the user’s first device type in profile, but fetch the current device using user.
By leveraging both profile and user effectively, you can create powerful, personalized experiences in Adobe Target that adapt to both short-term interactions and long-term user behavior.
Let me know if any corrections?