Leiste mit Community-Erfolgen erweitern.

Submissions are now open for the 2026 Adobe Experience Maker Awards
GELÖST

How to define Target Audience group using page js variable

Avatar

Level 2

Hi Adobe community,

 

Assuming I have a JavaScript variable named "userProfile" on a website, that is to identify if a user is login.

How can I use Target to access the variable and target the visitors by their "userProfile" value?

The goal is to define a Target audience for the login users so I can design the corresponding AB testing activity.

Themen

Anhand von Themen werden Community-Inhalte kategorisiert und Sie können so relevanten Inhalt besser finden.

1 Akzeptierte Lösung

Avatar

Korrekte Antwort von
Community Advisor

Hi @ChrisCh4 

In this scenario - you can use of variable called "userProfile" as a part of in-mbox profile attributes and based on the value outcome you can target to users. 

The benefit would be that the profile parameter directly available under "Visitor Profile" section in Adobe Target UI. 

below is the link How Do I Get Data into Target Using In-Page Profile Attributes? | Adobe Target 

 

Or the another approach would be to use as a profile script. 

https://experienceleague.adobe.com/en/docs/target/using/audiences/visitor-profiles/profile-parameter...

 

Hope this helps. 

 

 

Lösung in ursprünglichem Beitrag anzeigen

2 Antworten

Avatar

Korrekte Antwort von
Community Advisor

Hi @ChrisCh4 

In this scenario - you can use of variable called "userProfile" as a part of in-mbox profile attributes and based on the value outcome you can target to users. 

The benefit would be that the profile parameter directly available under "Visitor Profile" section in Adobe Target UI. 

below is the link How Do I Get Data into Target Using In-Page Profile Attributes? | Adobe Target 

 

Or the another approach would be to use as a profile script. 

https://experienceleague.adobe.com/en/docs/target/using/audiences/visitor-profiles/profile-parameter...

 

Hope this helps. 

 

 

Avatar

Employee Advisor

Hi @ChrisCh4,

As Gokul indicated you can send the data to Target as a custom parameter or a profile parameter. You can only send string data in those parameters. So you could possibly just send the userProfile directly (assuming it's a string) or you could send it in parts if it is an object. Here's an example:

userProfile = "loggedInCustomer:yes|cookies:true|favColor:blue"

//add to top of at.js file or before inclusion to the page
function targetPageParams() { return profile.userProfile=userProfile; }

 

If you're dealing with an object you could do something like this:

userProfile = {
  loggedInCustomer: true,
  cookies: true,
  favColor: "blue"
}

//add to top of at.js file or prior to the at.js inclusion
function targetPageParams() { return profile.loggedIn=userProfile.loggedInCustomer&profile.favColor=userProfile.favColor; }

 

Then this userProfile data will be getting sent to Target and you'll be able to build an audience off of it by creating an audience rule based on: visitor profile > loggedIn when it equals 'true'. Or something like that. Do note that if your parameters in the TargetPageParams function do NOT have a "profile." prefix you'd find them in the custom parameter dimension in the audience rule builder and not the visitor profile dimension.