Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Homework Assignment #4 Geo Targeting for On-Device Decisioning

DavidSonPM
Employee
Employee

Geo Targeting

In this homework assignment, we are going to explore how geo targeting will work for on-device decisioning activities. There are a couple of ways we can support geo targeting for on-device decisioning.

 

#1 OOTB Geo Targeting

We recognize the fact that customers cannot integrate with a third party vendor to utilize geo targeting. For these customers, we would like to provide OOTB (out of the box) functionality where we can take care of resolving your end user's location when an IP address is provided.

 

 

 

targetClient.getOffers({
    decisioningMethod: "on-device",

    request: {

        context: {

            geo: {

                ipAddress: "127.0.0.1"

            }              

        },      

        execute: {

            pageLoad: {}

        }         

    }

})  

 

 

 

When we initially retrieve the artifact from the Akamai CDN, we also retrieve the user's geo location in the headers. We then create a dedicated cookie called at_geo which contains this information. When a getOffers() call is made with the ipAddress, we check the at_geo cookie to make the decision on-device.

 

Try it out

  1. Create a Target activity via the form-based composer with geo targeting using for example, city, country, state, latitude, or longitude. Make sure all other Target activity details are on-device decisioning capable.
  2. Launch and activate the Target on-device decisioning AB activity with geo targeting.
  3. Make sure that in your code, you are making the getOffers() call with context -> geo -> ipAddress like the example above. The ipAddress that is passed in for your test should be from the location of which you have created your test on-device decisioning AB activity.
  4. Verify that there is no Target edge server call to retrieve the experience. You can also check that at_geo cookie is created on your browser.

 

2. Integration with 3rd Party Vendors

If you are using a 3rd party vendor like MaxMind that provides you user geo location information, you can pass the geo location data into the getOffers() call in the correct parameters so that the decision can be still made locally without a server call.

 

const CONFIG = {
    client: "acmeclient",
    organizationId: "1234567890@AdobeOrg",
executionMode: "local" }; const targetClient = TargetClient.create(CONFIG); targetClient.getOffers({ request: { context: { geo: { city: "SANFRANCISCO", countryCode: "US", stateCode: "CA", latitude: 37.75, longitude: -122.4 } }, execute: { pageLoad: {} } } })

We now support multiple fields in context -> geo

 

Name

Type

minLength

maxLength

Description

Latitude

 

number

 

 

 

Longitude

 

number

 

 

 

countryCode

 

string

2

2

Country code in ISO 3166-1 alpha-2 format

 

stateCode

 

string

1

3

Alphanumeric characters representing the subdivision part from ISO 3166-2

city

 

city

 

50

 

zip

 

zip

 

12

 

 

Try it out

1. Create a Target activity via the form-based composer with geo targeting using for example, city, country, state, latitude, or longitude. Make sure all other Target activity details are on-device decisioning capable.

2. Launch and activate the Target on-device decisioning AB activity with geo targeting.

3. Make sure that in your code, you are retrieving the geo location from a 3rd party vendor like MaxMind and put the corresponding fields into the getOffers() call in context -> geo like the example above. See that there is no server call being made for the decision.

0 Replies