is it possible to detect the device inside my marketing cloud email.

I want to know if it is an android or an iOs.

If it was not an email, I would use javascript client side this way: https://stackoverflow.com/a/13819253/1948785

but I am not sure if it can work always in a marketing cloud email (server side)

Thank you

1 Answer 1


By its very nature the detection for a client device has to be client-side code, as you allude to.

AMPScript is server-side code, so you wont have any luck with that in an email.

You can do this with server-sided code only once people click on a link to a cloudpage with AMPScript or SSJS, here is the AMPScript function. Just put on a CloudPage and preview to see your own device:



If it's only about controlling different layouts in an email, then CSS Media Queries are the way to go. Media Queries in CSS are client-side code inside an email used to detect the device, but they control only styling, so you could display different content per device. This of course does not log anything or help with other data-driven decisions.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .