All questions

Geo-targeting a VTEX storefront by region, what signal do I use?

Asked by bruno_qa on

Bbruno_qa

National VTEX retailer. We want a different homepage banner for shoppers in one state versus the rest of the country.

A few things I want to pin down before I build it:

  • which location signal do I match on
  • does it need any store-side geo code or a header we have to pass
  • what happens for a visitor whose location cannot be resolved

trying to enumerate the edge cases before I ship it

Was this helpful?

2 answers

PRPriya Raghavan

Location is resolved by Croct, so there is no store-side geo code to add and no header to pass. You match on the location context directly. For a single state the form is:

location's stateCode is "sp"

The audience is evaluated in real time and attached to the experience serving the banner slot, so it re-checks per interaction. On your unresolved-location edge case: undefined variables evaluate to false, so a visitor Croct cannot place simply will not match the state audience and falls through to your default banner, which is usually the behaviour you want.

Was this helpful?
Mmarcus_shop

If you ever need it narrower than a state you can go city level:

location's cityName is "sao paulo"

And you can combine location with device or weekday in the same condition, same style as the weekday targeting examples or the mobile users in one state audience. Handy if the banner should only run on mobile in that region.

Was this helpful?
Bbruno_qa

stateCode is what I was after, and good to know unresolved just falls through to default. that covers my edge cases

Still have questions?