Capture a lead's device for mobile landing pages

  • 1 April 2012
  • 6 replies
  • 14 views

When I export leads, I want to know who is an Android user, who’s an iPhone user, etc.


6 replies

Hi Jess,

Should I name the Hidden Field “user_agent” then as per your script ? or still “user agent” ?

Thanks

David

Userlevel 7
Badge +1

Here’s an updated script for anyone else looking to achieve this functionality:

<script>
      document.addEventListener('DOMContentLoaded', function() {
        document.querySelector('input#user_agent').value = navigator.userAgent;
      });
    </script>
Userlevel 2

Hi Mark, and anyone else reading this Ð

We’re not exactly sure what happened to Carl’s script, but try this: https://gist.github.com/markwainwrigh…

It’ll place the lead’s user-agent string in a hidden field. This string gives you information on what browser and operating system the visitor is using, as well as the version of each.

Hi, the link to the script on github doesn’t work. Could you re-post the link?

It works! 🙂

That’s a great idea, will add that one to our suggestions list.

In the meantime, this is a bit of a hack, but you could…

  1. Add a hidden field to your forms and name it “user agent”.
  2. Add the following script to your page using our Scripts tool (place it “After Body Tag”):

https://raw.github.com/gist/2285441/2…

You should now get the browser/OS for each lead submitted. You can tweak the code near the bottom if you’d like to change what gets captured. Note that Android phones will show up as “Linux/Mozilla”.

Really hope that helps until we can get something into the product.

Reply