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

Avatar

Avatar
Boost 1
Level 1
marwal1
Level 1

Like

1 like

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
marwal1
Level 1

Like

1 like

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
marwal1
Level 1

26-07-2020

Hello,

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 profile.geolocation.city for that?

 

Also, can I pass the user's location (profile.geolocation.city?) 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 (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 25
Employee
ryanr701
Employee

Likes

203 likes

Total Posts

224 posts

Correct reply

91 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Give Back 25
Employee
ryanr701
Employee

Likes

203 likes

Total Posts

224 posts

Correct reply

91 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile
ryanr701
Employee

29-07-2020

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): https://docs.adobe.com/content/help/en/target/using/experiences/offers/passing-profile-attributes-to...

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: https://docs.adobe.com/content/help/en/target/using/audiences/visitor-profiles/variables-profiles-pa...

So in your specific example, you could update the text on your page to say: "Find new cars in ${profile.geolocation.city}". 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 ${profile.geolocation.city} 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">${profile.geolocation.city}</span></h2>
<script>
document.querySelector("h2").setAttribute("title", "Find cars in ${profile.geolocation.city}");
</script>

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.

-Ryan

Answers (0)