Skip to content

Use Case 1 – Providing Location Data

fritzrichter edited this page Oct 6, 2020 · 1 revision

Introduction

Providing raw location data to adsquare helps advertisers to target POIs, build geo-behavioral segments or provide location insights as well as onboard offline data.

Streaming (in app SDK) vs. Batch File Processing

As a data provider for raw location data (e.g. an app publisher), you can provide location data to adsquare two different ways, which are basically:

  1. Streaming location data directly through your app (Android or iOS) by using the open source framework OpenLocate and defining adsquare as an endpoint or...
  2. By providing batch files and using the data-delivery library to prepare and share the files to adsquare's AWS S3 endpoint.

Streaming via OpenLocate

OpenLocate is an open source initiative supported by developers, non-profits, trade groups, and industry partners (including adsquare). The objective of OpenLocate is to provide developers with tools to transparently collect and use location data in their mobile applications. The cornerstone of this initiative is a lightweight, battery efficient, open source SDK for iOS and Android.

In order to share raw location data with adsquare, you simply define adsquare as an endpoint within your configuration. See the following example:

For example, to send data to adsquare within Android:

Assuming you have a companyId and x-auth-token from adquare:

HashMap<String, String> headers = new HashMap<>();
headers.put("X-AUTH-TOKEN", "<TOKEN>");

Configuration config = new Configuration.Builder()
        .setUrl("https://amp.adsquare.com/api/v1/openlocate/<companyId>/event")
        .setHeaders(headers)
        .build();
try {
  OpenLocate.getInstance(context).startTracking(config);
} catch (Exception e) {
  Log.e("OpenLocate", e.getMessage())
}

For example, to send data to adsquare within iOS:

Assuming you have a companyId and x-auth-token from adquare:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? ) -> Bool {

    let companyId = "<YOUR_COMPANY_ID>"
    let token = "TOKEN"
    
    let url = URL(string: "https://amp.adsquare.com/api/v1/openlocate/\(companyId)/event")!
    let headers = ["X-AUTH-TOKEN": "\(token)"]
    
    let configuration = Configuration(url: url, headers: headers)
    
    do {
        try OpenLocate.shared.initialize(with: configuration)
    } catch {
        print(error)
    }
}

Batch file support via the data-delivery library

Data providers who collect their location data on their own or can access location data offline from their infrastructure often prefer the data delivery via batch files, which is a safe, reliable and optimised alternative to the streaming approach. The data-delivery library provides support for preparing, normalising, compression and transmitting the data in the most efficient way to adsquare's AWS S3 endpoint.

Depending which attributes you want to provide on top of the raw-location data, the example-ssp project provides a nice example of how to make use of adsquare's data-delivery library.