Call APIs via Snapshots

Since Snapshots can trigger JavaScript on your page, Snapshots can be used to call third party APIs, including Heap’s API. As an example, the snippet below adds your users’ most current timezone as a property.

Name: Add timezone as user property

JavaScript Snapshot:

(function() { var tz = Intl.DateTimeFormat().resolvedOptions().timeZone; heap.addUserProperties({ "Timezone": tz }); })();

The Snapshot above is used to trigger Heap’s client-side user property API, and it doesn’t return any data for the Snapshot property. The “Add timezone as user property” name is used simply to let us know what the Snapshot does for this example.

Once captured, you can use this data in your analysis to understand how well your geographically targeted ads are performing.