The WonderPush Developer Hub

Welcome to the WonderPush developer hub. You'll find comprehensive guides and documentation to help you start working with WonderPush as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Geo-targeting

WonderPush lets you target users based on their location

Geo-targeting is a powerful way to reach out to your subscribers. WonderPush lets you send push notifications to your subscribers based on:

  • their country or city, based on their IP address, as returned by GeoJS,
  • their geographic coordinates (latitude and longitude) as provided by their mobile phone or web browser.

Geo-targeting based on the subscriber's IP address

📘

Geo-targeting based on IP address is only available for websites. Mobile applications can achieve the same, but it's the developer's responsibility to call GeoJS (or any other service) and fill Properties.

WonderPush relies on GeoJS for IP geolocation. Here's how it works:

  1. The subscriber visits your website
  2. WonderPush determines that his location is needed because it's missing or older than 1 hour
  3. The subscriber's web browser makes an AJAX call to https://get.geojs.io/v1/ip/geo.json that returns geolocation information based on the subscriber's IP address
  4. The WonderPush Javascript SDK sets the following properties on the subscriber:
  • string_city: the city name in English
  • string_country: the country name in English
  • string_country_code: 2 letter ISO 3166 country code
  • string_country_code3: 3 letter country code.
  • string_region: the region name in English.

You can then create Segments based on these four Properties and reach subscribers based on their city or country.

To include the city and country names directly in your messages, see Personalized content.

Adding IP-based geo-targeting to your site

Adding IP-based geo-targeting to your site is easy, just update your WonderPush initialization snippet to look like this (don't forget to adapt YOUR_WEBKEY):

 

<script>
  WonderPush.push(["init", {
    webKey: "YOUR_WEBKEY",

    // Add the 3 lines below to activate IP-based geo-targeting:
    plugins: {
      geojs: {},
    },

  }]);
</script>

📘

WordPress

WordPress users cannot directly modify their init options like shown above. They should instead use the Advanced tab of the WonderPush plugin and set the following in their Additional init options JSON:

{ "plugins": { "geojs": {} } }

Geo-targeting based on geographic coordinates

Both mobile devices and web browsers can collect their users's geographic coordinates. If your app or website collects user location through the browser or mobile device, so does WonderPush. This works slightly differently between websites and mobile applications.

Mobile applications

Mobile application developers who wish to target their users in WonderPush based on their location need to perform all of these steps:

  1. prompt users for the permission to use their location
  2. enable the collection of location information.

There is extensive documentation on how to do this in iOS and Android.

Once you've set up your app to collect location, WonderPush automatically lets you target mobile users based on that information.

Websites

Web developers who wish to target their users in WonderPush based on their location need to either:

Once location information is collected, targeting users based on their location is easy and can be achieved by creating a segment.

Geo-targeting based on mobile geofence trigger

A geofence is a custom geographical region that you specify. Triggering your push notification by geofence means your user will receive the notification the moment they enter (or exit) a geofence region, even if the application is not launched.

  1. Follow this guide to set up Geofencing on iOS and this one for Geofencing on Android
  2. When a Geofence is triggered, use the WonderPush trackEvent method
    For example: WonderPush.trackEvent("Enter the Stadium")
  3. Go to your dashboard and create a notification with a behavioral scheduling and target the users who performed the event:

Updated 7 months ago


Geo-targeting


WonderPush lets you target users based on their location

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.