For example , I make Experiences A and Experiences B , and deploy on my site, now I want get the current experience name or id with javascript , how should i do ?
thanks a lot !
Solved! Go to Solution.
Hi ,
As suggested by Thomas, You can use the pass the below code in custom code section of each experience variation of the test to fetch the experience ID etc.
<script type="text/javascript">
var sCampaignName='${campaign.name}';
var sExperienceName = '${campaign.recipe.name}';
var scampId='${campaign.id}';
var sExpId=${campaign.recipe.id}'
alert("Your Campaign name is " + '${campaign.name}' + " :Your Experience name is "+ '${campaign.recipe.name}'+" :Your campaign Id is "+'${campaign.id}' +" :Your Experience ID is "+ '${campaign.recipe.id}' );
</script>
Regards
Parit Mittal
Hi,
You can print those information by writing {campaign.name} or {campaign.id} as part of the HTML/JS returned in an experiment. See the full list of parameters here: Useful Variables, Profiles, Parameters, and Methods
/Løjmann
Hi ,
As suggested by Thomas, You can use the pass the below code in custom code section of each experience variation of the test to fetch the experience ID etc.
<script type="text/javascript">
var sCampaignName='${campaign.name}';
var sExperienceName = '${campaign.recipe.name}';
var scampId='${campaign.id}';
var sExpId=${campaign.recipe.id}'
alert("Your Campaign name is " + '${campaign.name}' + " :Your Experience name is "+ '${campaign.recipe.name}'+" :Your campaign Id is "+'${campaign.id}' +" :Your Experience ID is "+ '${campaign.recipe.id}' );
</script>
Regards
Parit Mittal
thanks everyone !
Now anther question: Now I know the info (id ,name etc) of one experience , how can I get the offers or the actions of the experience with javascript ?
Views
Replies
Total Likes
What do you think of here? Do you want the offer name and conversion measure, into JS?
As far as I know, you can't get the conversion points in (that is taking measure server-side), the only campaign related variables you can fetch are:
/Løjmann
Hi ,
you can use below to get the offers for each experience with Javascript.
Also, to measure the Action you have to set up Goals with your test. Please see the following link for more help :Goals and Settings
Views
Replies
Total Likes
for example, I make Experiences A and Experiences B ,
experience name experience id
Experiences A 0
Experiences B 1
and the action of Experiences A which id is 0 is just set the background-color to white:
[{
"actions": [{
"property": "background-color",
"action": "setStyle",
"selector": "HTML > BODY > DIV:nth-of-type(1)",
"priority": "important",
"value": "rgba(255,255,255,1)",
"cssSelector": "HTML > BODY > DIV:nth-of-type(1)"
} ]
}]
and Experiences B which id is 1 is set the background-color to black;
[{
"actions": [{
"property": "background-color",
"action": "setStyle",
"selector": "HTML > BODY > DIV:nth-of-type(1)",
"priority": "important",
"value": "rgba(0,0,0,1)",
"cssSelector": "HTML > BODY > DIV:nth-of-type(1)"
} ]
}]
on the test page I have got the a Experience id 1 which is from my database , now I want to get below info from the id 1:
[{
"actions": [{
"property": "background-color",
"action": "setStyle",
"selector": "HTML > BODY > DIV:nth-of-type(1)",
"priority": "important",
"value": "rgba(0,0,0,1)",
"cssSelector": "HTML > BODY > DIV:nth-of-type(1)"
} ]
}]
how should I do ?
Views
Replies
Total Likes
Hi ,
As far as I know, you can't fetch the actions in an experience inside a test. As decribed by Løjmann you can only fetch campaign below variables using Javascript.
Regards
Parit Mittal
Views
Replies
Total Likes
Hi Parit,
is this supposed output to the console when a test page is loaded? If so, I don't see anything at.
I added this to the Custom Code section of Exp. A and Exp. B.
Also, which cookie ties a visitor to a specific experience and prevents them from being part of Exp. A and Exp. B.?
Ali
Views
Replies
Total Likes
Hi there,
If I am reading it correctly, you are looking for Experience Targeting where Experience Audiences are derived by a value that you are extratcing from your dataabse. In that case, flow will look like:
1. Data (for your example, this will be ID 0 or 1) on the basis of which experience needs to be selected.
2. Pass this data using targetPageParams to Global mbox call (say expId=0 and expId=1)
3. Create Audiences on the basis of passed parameter and different values.
4. Use these audiences in an Experience Targeting activity where offer-code just returns a JSON object as you have stated below.
Let me know if my interpretation was wrong,
Regards,
Rajneesh
Views
Replies
Total Likes
Hey alim92960278,
This will not print anything into the console unless you explicitly tell it to. You may want to instead console.log it like this
<script>
console.log("Your Campaign name is " + '${campaign.name}');
console.log("Your Experience name is "+ '${campaign.recipe.name}');
console.log("Your Campaign ID is "+ '${campaign.id}');
console.log("Your Experience ID is "+ '${campaign.recipe.id}');
</script>
Also you may want to look at this documentation which Adobe provides on what useful parameters you can use found here: Useful Variables, Profiles, Parameters, and Methods
Target Troubleshooting - YouTube at 12:00 mins
Important: Make sure you also enable the response tokens if you need this to show up:
Thanks for the info!
Views
Like
Replies
Views
Likes
Replies
Views
Likes
Replies