3 Replies Latest reply on Apr 17, 2014 6:02 PM by Jon Wu

    Detect OS and associate ir with a lead/anonymous visitor

      Is it possible to detect a visitor's OS (especially Windows XP) and store this information in each record?
      We need to create specific campaigns targetting these people and it would be very valuable for us.
        • Re: Detect OS and associate ir with a lead/anonymous visitor
               You can set a custom field (string) and then capture the browser’s details using JavaScript. A single instruction gathers the browser, operating system, language and other details.
                
               The instruction is navigator.userAgent
                
                
               Using jQuery $('#UserAgent').val(navigator.userAgent);
                
               Chrome’s response is similar to
               Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.149 Safari/537.36
                
               Firefox’s is
               Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0
          • Re: Detect OS and associate ir with a lead/anonymous visitor
            Thank you Breno,
            I understand that with this javascript you can detect the OS. But how do we save this info in the database, even for anonymous leads.
            Do we have to use this code?
            
            
            1.           mktoMunchkinFunction(
            2.              'associateLead',
            3.              {
            4.                 OS: user_agent_string} );
            5.            
            6.           Thank you

            1.            
            • Re: Detect OS and associate ir with a lead/anonymous visitor
              Jon Wu
              I'm just getting started here, but I don't think you can add data for anonymous leads. You could log a page view on a bogus URL such as /user-agent/ then pass the user agent as a URL encoded query param.

              Better yet, user agents are pretty crazy so you might want to normalize them. I've found this open source library to be very useful: http://uadetector.sourceforge.net/.