Expand my Community achievements bar.

SOLVED

Difference between "profile." and "user."?

Avatar

Level 2

In docs referencing Target profile parameters, I see two different ways of interacting with Target profile.

 

user.THING  and profile.THING

 

What's the difference and when do you use one vs. the other?

Note: https://experienceleague.adobe.com/docs/target/using/audiences/visitor-profiles/profile-parameters.h...

 

References profile.get() and user.get() 

 

Code example here:
https://experienceleague.adobe.com/docs/target/using/audiences/visitor-profiles/profile-parameters.h...

 

Uses both "user." and "profile."

 

Thanks

 

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10
  1. When you want to set a persistent attribute in a JS implementation, you set a profile.SOMETHING parameter.
  2. AT creates some profile parameters automatically too. For example, profile.sessionCount, profile.geolocation.country.
  3. Each profile script becomes user.PROFILESCRIPTNAME. When you want to reference a profile script in another profile script or in an experience as a dynamic placeholder, you can do it via user.PROFILESCRIPTNAME
 

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @J2_2 profile.THING is profile parameter of an user profile . user.THING is the profile script

Avatar

Level 2
Thanks for the answer - what is the difference in practical terms? It looks as though they are interchangeable how they are used, and both can save to and pull from, the Visitor Profile, when fired "on the page".

Avatar

Correct answer by
Level 10
  1. When you want to set a persistent attribute in a JS implementation, you set a profile.SOMETHING parameter.
  2. AT creates some profile parameters automatically too. For example, profile.sessionCount, profile.geolocation.country.
  3. Each profile script becomes user.PROFILESCRIPTNAME. When you want to reference a profile script in another profile script or in an experience as a dynamic placeholder, you can do it via user.PROFILESCRIPTNAME
 

Avatar

Level 1

It looks like when you Pass information into Target -- for example, using adobe.target.trackEvent or mboxCreate as seen here

 

adobe.target.trackEvent({
    "mbox": "clicked-cta",
    "params": {
        "param1": "value1"
    }
});
// source: https://experienceleague.adobe.com/docs/target-dev/developer/client-side/at-js-implementation/functions-overview/adobe-target-trackevent.html?lang=en

 

or here

 

mboxCreate("landingpage", "profile.keyword=World Cup");
// source: https://experienceleague.adobe.com/docs/target/using/experiences/offers/passing-profile-attributes-to-the-html-offer.html?lang=en

 

-- you use profile. syntax to retrieve this data in HTML (for dynamic content) like this

 

<h1>Get your ${profile.keyword} information here!</h1>
<p>The value ${profile.param1} was passed in.</p>

 

or retrieve it in a profile script like this

 

let example1 = profile.get("param1");
let example2 = profile.get("keyword");

 

 

Whereas, user. syntax is used to reference variables created inside of the profile script.

From the documentation, it says this,

 

Implementation

For profile parameters passed into an mbox, use the syntax:

${profile.parameter}

For profile parameters created in a profile script, use the syntax:

${user.parameter}

 

source: https://experienceleague.adobe.com/docs/target/using/experiences/offers/passing-profile-attributes-t...

 

Also see this for profile attributes for more on user. syntax https://experienceleague.adobe.com/docs/target/using/audiences/visitor-profiles/profile-parameters.h...