Question

Want to Capture and pass browser language to WhatConverts

  • 7 December 2023
  • 2 replies
  • 17 views

Badge

What I want to achieve: Capture user’s browser language and pass it to WhatConverts. Prefereably without making the field visible.

 

What I have tried:

  • Created a javascript to capture the browser language.
  • Created a hidden field inside the lightbox form. Proceeded to store the value in that hidden field.
  • Waited for it to show as mapping field option inside WhatConverts app. [Did not happen]
  • Reached out to Support on WhatConverts and Unbounce.

Output:

Neither could do it out of the box and keep mentioning custom code. Unbounce just said I should use additional form software. WhatConverts support was more helpful and suggested that I put the field as a visible and then their app would be able to capture that field. However, that would be my last option considering that it would be showing the fields that don’t need to get showcased
Classic Builer


2 replies

Userlevel 7
Badge +3

Hi @Hardik

Something like this might do the trick and write the browser language to a hidden field: 
 

window.onload = function() {
// Get the browser's language
var language = navigator.language || navigator.userLanguage;

// Find the existing hidden input by its name and set its value
// Replace 'browser_language' with the actual name or ID of your hidden field if it's different
document.getElementsByName('browser_language')[0].value = language;
};

 

Badge

Thanks for the response @Hristian.

I forgot about the post completely.

I ended up solving it by using a regular visible field and then using JavasScript to hide it. {Could’ve also used CSS, I guess}

Not the most ideal situation, but things are working as I need them to, so we’re all good.

The problem arose because WhatConverts cannot read from a hidden field earlier.
 

Reply