Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How can i get the ID or title of the current exprience in the page where is tested?

Avatar

Avatar
Validate 1
Level 2
tut54841492
Level 2

Likes

6 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
tut54841492
Level 2

Likes

6 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
tut54841492
Level 2

03-06-2017

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 !

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

90 likes

Total Posts

817 posts

Correct Reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

90 likes

Total Posts

817 posts

Correct Reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
ParitMittal
Level 10

04-06-2017

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

Answers (10)

Answers (10)

Avatar

Avatar
Contributor
Level 3
johnanish
Level 3

Likes

27 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Contributor
Shape 1
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Contributor
Level 3
johnanish
Level 3

Likes

27 likes

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Contributor
Shape 1
Give Back 5
Give Back 3
Give Back
View profile
johnanish
Level 3

16-10-2018

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:

response_tokens.jpg

Avatar

Avatar
Validate 1
Level 4
Løjmann
Level 4

Likes

35 likes

Total Posts

117 posts

Correct Reply

42 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
Løjmann
Level 4

Likes

35 likes

Total Posts

117 posts

Correct Reply

42 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
Løjmann
Level 4

03-06-2017

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

Avatar

Avatar
Validate 25
Level 4
alim92960278
Level 4

Likes

37 likes

Total Posts

103 posts

Correct Reply

5 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 4
alim92960278
Level 4

Likes

37 likes

Total Posts

103 posts

Correct Reply

5 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
alim92960278
Level 4

16-10-2018

Thanks for the info!

Avatar

Avatar
Validate 1
Level 4
Løjmann
Level 4

Likes

35 likes

Total Posts

117 posts

Correct Reply

42 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Validate 1
Level 4
Løjmann
Level 4

Likes

35 likes

Total Posts

117 posts

Correct Reply

42 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 25
Boost 10
View profile
Løjmann
Level 4

05-06-2017

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:

  • campaign.name
  • campaign.id
  • campaign.recipe.name
  • campaign.recipe.id
  • offer.name
  • offer.id

/Løjmann

Avatar

Avatar
Contributor
Level 4
rajneesh_gautam
Level 4

Likes

62 likes

Total Posts

66 posts

Correct Reply

12 solutions
Top badges earned
Contributor
Ignite 5
Ignite 3
Ignite 1
Validate 1
View profile

Avatar
Contributor
Level 4
rajneesh_gautam
Level 4

Likes

62 likes

Total Posts

66 posts

Correct Reply

12 solutions
Top badges earned
Contributor
Ignite 5
Ignite 3
Ignite 1
Validate 1
View profile
rajneesh_gautam
Level 4

18-04-2018

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

Avatar

Avatar
Validate 25
Level 4
alim92960278
Level 4

Likes

37 likes

Total Posts

103 posts

Correct Reply

5 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile

Avatar
Validate 25
Level 4
alim92960278
Level 4

Likes

37 likes

Total Posts

103 posts

Correct Reply

5 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 5
Boost 3
View profile
alim92960278
Level 4

17-04-2018

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

Avatar

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

90 likes

Total Posts

817 posts

Correct Reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

90 likes

Total Posts

817 posts

Correct Reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
ParitMittal
Level 10

06-06-2017

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.

  • campaign.name
  • campaign.id
  • campaign.recipe.name
  • campaign.recipe.id
  • offer.name
  • offer.id

Regards

Parit Mittal

Avatar

Avatar
Validate 1
Level 2
tut54841492
Level 2

Likes

6 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
tut54841492
Level 2

Likes

6 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
tut54841492
Level 2

05-06-2017

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 ?

LøjmannParitMittal

Avatar

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

90 likes

Total Posts

817 posts

Correct Reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 10
Level 10
ParitMittal
Level 10

Likes

90 likes

Total Posts

817 posts

Correct Reply

349 solutions
Top badges earned
Validate 10
Validate 1
Boost 50
Boost 5
Boost 3
View profile
ParitMittal
Level 10

05-06-2017

Hi ,

you can use below to get the offers for each experience with Javascript.

  • ${offer.name}
  • ${offer.id}

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

Avatar

Avatar
Validate 1
Level 2
tut54841492
Level 2

Likes

6 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
tut54841492
Level 2

Likes

6 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
tut54841492
Level 2

05-06-2017

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 ?

LøjmannParitMittal