How to define Target Audience group using page js variable | Community
Skip to main content
Level 2
June 24, 2024
Solved

How to define Target Audience group using page js variable

  • June 24, 2024
  • 2 replies
  • 950 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Gokul_Agiwal

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-parameters

 

Hope this helps. 

 

 

2 replies

Gokul_Agiwal
Community Advisor
Gokul_AgiwalCommunity AdvisorAccepted solution
Community Advisor
June 24, 2024

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-parameters

 

Hope this helps. 

 

 

Adobe Employee
June 27, 2024

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.