Expand my Community achievements bar.

SOLVED

Adobe target selector not working in adobe.target.applyOffer

Avatar

Level 2

Hi All,

I am creating an regional mbox for my implementation.

Below is the code that I have written. I am getting an error as shown in the snapshot .

 

Please let me know what is correct way to write the code in selector section(highlighted in bold in the code)  for  "adobe.target.applyOffer"

 

$('.col-lg-4.col-sm-6').eq(1).addClass('mbox-name-homepage-txt'); adobe.target.getOffer({ "mbox": "txt", "params":{ "name_of_page":"Profile Page3", "pro_uname": "Uber CRO3" }, "success": function(offer) { adobe.target.applyOffer({ "mbox": "txt","selector": ".col-lg-4.col-sm-6.eq(0)", offer: offer }) }, "error": function(status, error) { console.log('Error', status, error); } });

I have also used "selector": "(.col-lg-4.col-sm-6).eq(0)" and it is not working

 

 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @avez try this:

$('.col-lg-4.col-sm-6').eq(1).addClass('mbox-name-homepage-secondary-4'); adobe.target.getOffer({ "mbox": "homepage-secondary-4", "params":{ "name_of_page":"Profile Page3", "pro_uname": "Uber CRO3" }, "success": function(offer) { adobe.target.applyOffer({ "mbox": "homepage-secondary-4","selector": ".mbox-name-homepage-secondary-4", offer: offer }) }, "error": function(status, error) { console.log('Error', status, error); } });

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi @avez try this:

$('.col-lg-4.col-sm-6').eq(1).addClass('mbox-name-homepage-secondary-4'); adobe.target.getOffer({ "mbox": "homepage-secondary-4", "params":{ "name_of_page":"Profile Page3", "pro_uname": "Uber CRO3" }, "success": function(offer) { adobe.target.applyOffer({ "mbox": "homepage-secondary-4","selector": ".mbox-name-homepage-secondary-4", offer: offer }) }, "error": function(status, error) { console.log('Error', status, error); } });

Avatar

Level 2

Thank @ambikaTewari_ATCI 

 

It worked for me. But i am really confused why my code is not working .Is there any limitation/restriction from Adobe target about which selector we use in the code?