at.js 2.x equivalent of browserWidth or mbox.param('browserWidth') ?

christophert819 20-11-2019

As mentioned in : Upgrading from at.js 1.x to at.js 2.x ,

There doesn't seem to be support for the following mbox parameters when upgraded to 2.x.

2019-11-20 17_12_13-Upgrading from at.js 1.x to at.js 2.x.png

I'm currently trying to create audiences where I only want visitors whose browserWidth is greater than 800px to qualify for a specific experience in my activty. Visitors whose browserWidth is less than 799px would be allocated into another audience, and served a different experience.

I've tried implementing in this in the audience, but because the site I work on utilizes at.js 2.x, the following implementation didn't work. I've tested it.

1857325_pastedImage_4.png

I've also tried creating Profile scripts to retrieve the value of mbox.param('browserWidth'), but that doesn't work either.

Is there a method that I can use to grab the browser width of the visitor in at.js 2.x? I don't have access to adobe launch, so changes in there would not be an option.

Accepted Solutions (1)

Accepted Solutions (1)

Shruthi_N
Employee
21-11-2019

​ As mentioned above, there is an enhancement request logged for the same.

Ref: https://forums.adobe.com/ideas/11688  . Please feel free to upvote the idea so that if more users request the same it can be prioritized .

In the meantime, you could try and grab these values and pass them as custom parameters and then use them for targeting . For example, just pass a custom parameter named "browserWidth" and set it to document.body.offsetWidth . You could also use window.screen object to get the resolution of the screen (i.e. width and height of the screen).

Ref: https://www.tutorialrepublic.com/javascript-tutorial/javascript-window-screen.php

Hope this helps.

Answers (3)

Answers (3)

Shruthi_N
Employee
22-11-2019

christophert87757717​ Yes passing the custom parameter would require that you call the targetpageparams() function through DTM/Launch or on the page. If you don't have the option to do that I am afraid that the above suggested approach won't be applicable to you.

christophert819 21-11-2019

Hi Shruthi,

Thanks for the response! I don't have access to the company code base or Adobe Launch or DTM. How would you suggest passing the parameters before at.js 2.x is loaded? I've tried document.body.offsetWidth before in a profileScript, but I would receive an error stating my syntax was invalid.

surebee
Employee
20-11-2019

Hi christophert87757717​,

Thank you for reaching out! As outlined in Upgrading from at.js 1.x to at.js 2.x the browserWidth can no longer be used to create an audience out of the box with at.js 2.x as it is not captured as an "mbox" parameter. We do have an enhancement request logged internally for this feature.