Quantcast
Channel: Topliners : All Content - All Communities
Viewing all articles
Browse latest Browse all 3423

Determining a User's Language Preference

$
0
0

We are going to be sending email in several languages -- but the obvious question arose -- who should get what translation? (For example, you can't assume that someone in Canada will prefer English.)

I cobbled-together the following code that determines the user's language preference (as set through their browser, and retrieved through the HTTP headers) and puts it into a hidden field.

 

(So far, it seems to work for me.)  The next step would be to create segments based on the language code.

 

<script type='text/javascript' src='http://code.jquery.com/jquery-1.11.0.min.js'></script>

<script type="text/javascript">

 

$.ajax({

    type:     "GET",

    url: "http://ajaxhttpheaders.appspot.com",

    dataType: "jsonp",

    success: function(headers) {

        language = headers['Accept-Language'];

        document.getElementById('userLanguage').value=(language);

    }

});

</script>

 

and then place the following into the form:

 

 

<input type="hidden" name="language" id="userLanguage">

 

 

I'm an Eloqua newbie, so I was wondering if Eloqua already has a way of doing this? (I've looked and asked around, and have come up empty).

 

 

 

Thanks,

 

 

Charlie


Viewing all articles
Browse latest Browse all 3423

Trending Articles