Geo-Personalization: Pass user's location to html-code




I want to personalize a website by the location of the visitor.


For example, instead of writing: "Find new cars", I want to write: "Find new cars in {city}! So can I use Adobe Target to automatically replace the {city} string in the HTML code with the actual location of the user? Can I use for that?


Also, can I pass the user's location ( as input to a Javascript function that is part of my website?


Can this happen in real time, i.e. during the first page view of the first visit?

Accepted Solutions (0)

Answers (1)

Answers (1)




Hi @marwal1,

Yes, you can to each of your questions. Here's the help doc on using tokens in your content/modifications (including inside a script):

It shows the basic syntax for adding the dynamic data. Essentially, you insert like so: ${domain.attribute}

Here is a help doc that list out all the profiles and variables available in Target including the geolocation variables:

So in your specific example, you could update the text on your page to say: "Find new cars in ${}". Worth noting that all the geolocation values from Target are lower case so you may want to use some CSS to change the case. You can also use the ${} inside of a script too. So if I was modifying the HTML of an element I could insert a small script. For example:

<h2>Find new car's in <span class="titleCase">${}</span></h2>
document.querySelector("h2").setAttribute("title", "Find cars in ${}");

Target runs the geolocation look up on the first request of a session, so it will be available to use in the first page view of a first time visitors session.

Hope that helps.