Table of Contents

Geo-location

The Piano paywall provides a mechanism to geo-locate users and target business rules and marketing messages to them.

Tracking

If you want to only track the meter based on the browser's geolocation, you can configure this inside the Piano dashboard. This enables you to setup a paywall only for a certain geo-targeted set of users.

Targeting

To target different offers to different segments, you can inspect the meter object on the onMeterExpired callback and render different offers to different regions or countries.

tp.push(["init", function() {
    tp.meter.init({
        paywallId: "123456",
        onMeterExpired: function(meter) {
            if (meter.region === "Europe") {
                tp.offer.show({
                    offerId: "OABCDEF",      // the offer with the EUR terms
                    templateId: "OT1234567", // the template with european messaging
                });
            } else if (meter.country_code === "CA") {
                tp.offer.show({
                    offerId: "OBCDEFG",      // the offer with the canadian terms
                    templateId: "OT2345678", // the template with canadian messaging
                });            
            }
        },
        onShowOffer: function() {
            // this disables the default curtain and any reminders because
            // we are handling the rendering of the offers ourselves inside
            // of the onMeterExpired callback
            return false;
        }
    });
}]);