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

Is there a way to add conditional activation for activities?

Avatar

Avatar
Boost 1
Level 1
billc52928879
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
billc52928879
Level 1

Like

1 like

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
billc52928879
Level 1

13-09-2017

Let's say I only wanted to run an activities on pages where a certain DOM element exists (and there's no URL pattern that could be used for the "Page Delivery") - is there any way in Target to use a custom script to activate the activity?

Replies

Avatar

Avatar
Validate 250
Employee
Amelia_Waliany
Employee

Likes

190 likes

Total Posts

449 posts

Correct Reply

73 solutions
Top badges earned
Validate 250
Validate 100
Validate 50
Validate 25
Validate 10
View profile

Avatar
Validate 250
Employee
Amelia_Waliany
Employee

Likes

190 likes

Total Posts

449 posts

Correct Reply

73 solutions
Top badges earned
Validate 250
Validate 100
Validate 50
Validate 25
Validate 10
View profile
Amelia_Waliany
Employee

18-09-2017

Greetings, thanks for your question! For a VEC-based Activity, you need a URL to import the Activity. To learn more about whether it is possible to override the URL here, visit Visual Experience Composer Best Practices and Limitations. If the same DOM element ID is used on multiple elements on the page, changing one of those elements changes all elements with that ID. To prevent this from happening, an ID should be used only once on each page. This is a standard HTML best practice; for more information, see Page Modification Scenarios. For a Form-based Activity, you can use a custom script to run the Activity - just make sure to include the mboxCreate on the page.

Avatar

Avatar
Validate 1
Level 1
aellis82
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
aellis82
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
aellis82
Level 1

10-04-2018

Hello,

this question very much relates to our problem, but the response does not solve our problem and we'd really appreciate some help.

We're new to target and would help with setting up conditional activation of an A/B experiment.

We only wish to include visitors in the experiment when there are less than 3 instances of a particular div element on the page.

We can count the elements using $('.x').length where x is a class.

However we are unclear on how to target users for this particular scenario only. Currently, everyone who visits the page is included in the experiment, regardless of how many of this particular element are present and this isn't what we need.

Please help.

thanks,

Andrew

Avatar

Avatar
Give Back 10
Employee
siddharthjainPM
Employee

Likes

42 likes

Total Posts

65 posts

Correct Reply

15 solutions
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 5
View profile

Avatar
Give Back 10
Employee
siddharthjainPM
Employee

Likes

42 likes

Total Posts

65 posts

Correct Reply

15 solutions
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Ignite 5
View profile
siddharthjainPM
Employee

12-04-2018

Hi Andrew

So, these elements are dynamic? Some see 1, others see 2 or 3?

I would say that it might be a good option to see if something can be added in URL parameters based on the same business logic which is changing these element counts. Is that not doable?

Can you explain your use case bit more? What are these divs an?

Avatar

Avatar
Boost 1
Level 1
Harry_S
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
Harry_S
Level 1

Like

1 like

Total Posts

2 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
Harry_S
Level 1

12-04-2018

Hi Andrew,

The decision of campaign qualification happens on Edge server. Now to achieve the use case you can try to leverage presence of DOM element to set a parameter in mbox call which therefore can be used to decide campaign qualification.

Something Like:

targetPageParams: function() {

isElementPreset: $('#myElementId').length

}

Now the mbox parameter can be used to create a qualification audience isElementPreset > 3

Hope that answers your query

Avatar

Avatar
Contributor
Level 4
rajneesh_gautam
Level 4

Likes

64 likes

Total Posts

68 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

64 likes

Total Posts

68 posts

Correct Reply

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

13-04-2018

Hi there,

There are 2 possible solutions to your challenge, depending upon where data, on basis of which conditional activation needs to happen, is present.

1. If data is present before Global mbox is created:

If you have follwed best practice, Target library would sit in <HEAD>. In this case conditional activation data must be present before Target library. A common example for this is Data-layer objects. So if activty's activation is driven by rules that are defined using your Data-layer attributes, you can use targetPageParams method (See link below for more details).

Passing Parameters to a Global mbox

This method is used to set parameters which are passed to Global mbox when its requested to be created. It has to be set before the mbox Create call - use your Tag Management System for this purpose.

Passed variables then can be used to create Audiences (you will have to use Custom under Rule type).

2. If data is present after Global mbox is created:

In certain scenarios like presence of a <div> for qualifting a visitor for an activity, you cannot use targetPageParams approach as Global mbox is already created. In this case, you should  use following approach:

2.1 Create an activity (lets call it Activity A for now) using Global mbox which has All Visitors as Audiences and runs on the same page where particular <div> is present.

2.2 Code for this Activity A should search for the <div> presence and should call mboxUpdate(), passing an mbox parameter which suggests that condition for activity activation is true. Here’s the code I used:

var d = document.createElement("div");

d.id = "your-mbox-name_div";

document.body.appendChild(d);

mboxDefine(“your-mbox-name_div","your-mbox-name");

mboxUpdate("your-mbox-name","conditionalActivation=true");

2.3 Take Activity A live.

2.4 Setup an Audience on the basis of mbox used in step 2.2 and mbox parameter passed (you will have to use Custom under Rule type)

2.5 Now create a new Activity B that uses above mentioned mbox and Audience. This is your main activity where experience should change on the basis of conditional activation. As visitors get qualified only when <div> is present, your Visitor count should be accurate.

Hope this helps,

Rajneesh

Avatar

Avatar
Validate 1
Level 1
aellis82
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
aellis82
Level 1

Likes

2 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
aellis82
Level 1

13-04-2018

Thanks Ranjeesh,

really appreciate you taking the time to reply to this.

We've gone down the route of the second approach you mentioned. However, Activity B does not seem to be activating based on the Audience set by Activity A. The mBox has been created successfully on the page, the Audience conditions have been setup against Activity B, but when the page loads, it does not move from Activity A. And no matter what we do, we can't seem to trigger Activity B.

Any thoughts?

thanks,

Andrew

Avatar

Avatar
Contributor
Level 4
rajneesh_gautam
Level 4

Likes

64 likes

Total Posts

68 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

64 likes

Total Posts

68 posts

Correct Reply

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

16-04-2018

Hi Andrew, it could be a bit difficult to troubleshoot without looking at activity configuration so will try to share some potential next steps:

1. Check that your activity is not restricted by any Property-rules. Mbox updated through mboxUpdate() may not have at_property variable sent.

2. Check  mboxTrace to ensure you are qualifying for all required audiences

3. You havent got any Activity based audiences on that conflict with Experience Audiences.

Please DM me in case you want me to look into it in more details

Regards,

Rajneesh

Avatar

Avatar
Give Back 10
Employee
jrohit
Employee

Likes

14 likes

Total Posts

27 posts

Correct Reply

9 solutions
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Boost 5
View profile

Avatar
Give Back 10
Employee
jrohit
Employee

Likes

14 likes

Total Posts

27 posts

Correct Reply

9 solutions
Top badges earned
Give Back 10
Give Back 5
Give Back 3
Give Back
Boost 5
View profile
jrohit
Employee

18-04-2018

Hi Andrew,

Adding to the above, you need to use an XT campaign within Target to achieve the above. If you are using an A/B campaign then the user will be tied to the experience user is viewing. So if i see Experience A on first visit then I am tied to this experience.

~Rohit

Avatar

Avatar
Give Back 3
Level 2
richardlee
Level 2

Likes

10 likes

Total Posts

15 posts

Correct Reply

1 solution
Top badges earned
Give Back 3
Give Back
Ignite 1
Validate 1
Boost 5
View profile

Avatar
Give Back 3
Level 2
richardlee
Level 2

Likes

10 likes

Total Posts

15 posts

Correct Reply

1 solution
Top badges earned
Give Back 3
Give Back
Ignite 1
Validate 1
Boost 5
View profile
richardlee
Level 2

18-04-2018

Hi Andrew,

not sure if this helps but i'll share the solution we use for loading campaigns dynamically; we create 2 activities where one acts as a 'gateway' with conditional logic to load the actual activity with the test.


Here's the rough  outline of the code for the 'gateway' activity - note help-modal-test-mbox is the custom mbox used as the location in activity with the actual test:

jQuery(document).ready(function(){

  if(jQuery('#help-modal').length){

    // next part fecthes our actual offer there could be a delay so you need to be mindful of the impact to user i.e. hide/show or add a message whilst its loading

    adobe.target.getOffer({ 

      "mbox": "help-modal-test-mbox", // we create a custom mbox for our offer

      "success": function(offers) {

            // note you might want to add logic here to check an offer was returned (offer is an array)

            adobe.target.applyOffer( {

               "mbox": "help-modal-test-mbox",

               "offer": offers

            } );

      }, 

      "error": function(status, error) {         

         

          // fallback

          if (console && console.log) {

            console.log(status);

            console.log(error);

          }

         

      },

     "timeout": 5000

    });

  }

});