Does Marketo automatically track which device type was used when a lead submits their email using a Marketo form (ex. desktop, tablet, mobile).?
Hi Courtney,
By default, Marketo does not track what type of device was used to submit form, but you can track this with a little extra work. Now, there's dozens of ways to solve this potential problem, but I'm going to assume you don't want to track the size of the screen, or track what type of device is being used (say, an iPad vs. iPhone vs. Android vs. Blackberry), but simply "what device was used to fill out this form." Create a string field (in this case, I'm calling it userAgent) to store the value. Add this field as a hidden field for your form, and embed the following script somewhere on your landing page:
<script src="https://cdnjs.cloudflare.com/ajax/libs/mobile-detect/1.1.0/mobile-detect.js"></script>
<script>
var md = new MobileDetect(window.navigator.userAgent);
phone = md.mobile();
tablet = md.tablet();
if (phone) {
var ua = "Phone";
}
if (tablet) {
var ua = "Tablet";
}
if (phone == null && tablet == null) {
var ua = "Computer";
}
</script>
Then, when embedding your form, you would simply alter your embed to look like
MktoForms2.loadForm("//app-whatever.marketo.com", "123-ABC-456", 1234, function (form){
form.vals({"userAgent":ua});
});