Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results
Suggest Edits

track

Send additional events to Heap.

 
heap.track('Purchase', {dollars: 50, item: 'Furby'});
// Method signature
+ (void)track:(NSString *)event withProperties:(NSDictionary *)properties;

// Example
[Heap track:@"Open Album" withProperties:@{@"gallery": @"Picnic Photos", @"pictureCount": @50}];
// Method signature
public static void track(String event, /* @Nullable */ Map<String, String> properties);

// Example
Map<String, String> props = new HashMap<>();
props.put("gallery", "Picnic Photos");
props.put("pictureCount", String.valueOf(50));
Heap.track("Open Album", props);
Arguments
  1. event name: name of the custom interaction. Limited to 1024 characters.
  2. event properties: a JSON object, NSDictionary, or Map containing key-value pairs to be associated with an event. Keys and values must be a number or string with fewer than 1024 characters.

For Android, the properties map may be null to track an event with no properties. The property map keys and values must be converted to strings, but they can be queried as numbers in Heap.

Custom event properties can be queried in the same fashion as any other event property.

Suggest Edits

identify

Attach a unique identity to a user.

 

If you assign the same identity to a user on a separate device, their past sessions and event activity will be merged into the existing Heap user with that identity.

To better understand the client-side identify and addUserProperties APIs, take a look at our comprehensive guide.

heap.identify('alice123');
//Method Signature
+ (void)identify:(NSString *)identity;

// Example
[Heap identify:@"alice123"];
// Method signature
public static void identify(String identity);

// Example
Heap.identify("alice123");
Arguments
  1. identity: a case-sensitive string that uniquely identifies a user, such as an email, handle, or username. This means no two users in one environment may share the same identity. Must be fewer than 255 characters.

The string you pass to heap.identify() is case sensitive. To avoid split users due to capitalization, we recommend converting your identity to lowercase before sending to Heap if you are using email as the identity.

Suggest Edits

addUserProperties

Attach custom properties to user profiles.

 

The addUserProperties API lets you attach custom properties to user profiles, such as account-level info from your database, A/B test data, or demographic info.

To better understand the client-side identify and addUserProperties APIs, take a look at our comprehensive guide.

heap.addUserProperties({'Name': 'Alice Smith','Profession': 'Data Scientist'});
// Method signature
+ (void)addUserProperties:(NSDictionary *)properties;

// Example
[Heap addUserProperties:@{@"Name": @"Alice Smith", @"Profession": @"Data Scientist"}];
// Method signatures
public static void addUserProperties(Map<String, String> properties);

// Example
Map<String, String> props = new HashMap<>();
props.put("Name", "Alice Smith");
props.put("Profession", "Data Scientist");
Heap.addUserProperties(props);
Arguments
  1. user properties: a JSON object, NSDictionary, or Map containing key-value pairs to be associated with a user. Keys and values must be a number or string with fewer than 1024 characters.

Also, the string user_id cannot be used as a key in the user properties object.

For Android, the property map keys and values must be converted to strings, but they can be queried as numbers in Heap.

User properties are associated with all of the user's past activity, in addition to their future activity. Custom user properties can be queried in the same fashion as any other user property.

Requests are limited to 30 requests per 30 seconds per identity per app_id

Suggest Edits

addEventProperties

Specify a set of global key-value pairs to get attached to all of a user's subsequent events.

 

These event properties will persist across multiple sessions on the same device and get applied to both auto-captured and custom events.

This is useful if you have some persistent state, but you don't want to apply it across all of a user's events with identify. A good example is "Logged In", which changes over the user's lifecycle. You can use addEventProperties to measure how a user's behavior changes when they're logged in vs. when they're logged out.

heap.addEventProperties({'Logged In': 'true', 'Payment Plan': 'Free'});
// Method signature
+ (void)addEventProperties:(NSDictionary *)properties;

// Example
[Heap addEventProperties:@{@"Logged In": @"true", @"Payment Plan": @"Free"}];
// Method signature
public static void addEventProperties(Map<String, String> properties);

// Example
Map<String, String> props = new HashMap<>();
props.put("Logged In", "true");
props.put("Payment Plan", "Free");
Heap.addEventProperties(props);
Arguments
  1. event properties: a JSON object, NSDictionary, or Map containing key-value pairs to be associated with every subsequent event. Keys and values must be a number or string fewer than 1024 characters.

For Android, the property map keys and values must be converted to strings, but they can be queried as numbers in Heap.

Suggest Edits

removeEventProperty

Stops a single event property from getting attached to all subsequent events.

 
heap.removeEventProperty('Logged In');
// Method signature
+ (void)removeEventProperty:(NSString *)property;

// Example
[Heap removeEventProperty:@"Logged In"];
// Method signature
public static void removeEventProperty(String property);

// Example
Heap.removeEventProperty("Logged In");
// Method signature
public static void removeEventProperty(String property);

// Example
Heap.removeEventProperty("Logged In");
Arguments
  1. event property: name of the event property to remove. This stops attaching the property to all subsequent events.
Suggest Edits

clearEventProperties

Removes all stored event properties.

 
heap.clearEventProperties();
// Method signature
- (void)clearEventProperties;

// Example
[Heap clearEventProperties];
// Method signature
public static void clearEventProperties();

// Example
clearEventProperties();
Suggest Edits

userID and Identity

Retrieves the current user's ID or identity.

 

This is primarily used in conjunction with the server-side API. The user_id can only be used with anonymous users and the identity with identified users.

var userid = heap.userId;
var identity = heap.identity;
// Method signature
- (NSString * const)userId;

// Example
NSString *userid = [Heap userId];

These are not yet exposed in the Android SDK.

Suggest Edits

changeInterval

Changes the frequency with which events are sent back to the Heap server from an iOS mobile device.

 
+ (void)changeInterval:(double) interval;

// Change interval to send data every 25 seconds
[Heap changeInterval:25.0];
Arguments
  1. interval: number of seconds in length
Suggest Edits

setAppId

Sets the app ID where you'll be sending data. It can be used to switch between projects or between your production and development environments.

 
// Method signature
+ (void)setAppId:(NSString *) appId;

// Send data to a different project
// This is actually one of your project IDs!
[Heap setAppId:@"21"];
Arguments
  1. appId: the appId corresponding to one of your projects
posthttps://heapanalytics.com/api/track
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "app_id": "11",
    "identity": "alice@example.com",
    "event": "Send Transactional Email",
    "timestamp": "2017-03-10T22:21:56+00:00", 
    "properties": {
      "subject": "Welcome to My App!",
      "variation": "A"
    }
  }' \
  https://heapanalytics.com/api/track
A binary file was returned

You couldn't be authenticated

Try the API to see results

Body Params

app_id
string
required

The app_id corresponding to one of your projects.

identity
string
required

An identity, typically corresponding to an existing user. If no such identity exists, then a new user will be created with that identity. Case-sensitive string, limited to 255 characters.

event
string
required

The name of the server-side event. Limited to 1024 characters.

properties
object

An object with key-value properties you want associated with the event. Each key and property must either be a number or string with fewer than 1024 characters.

 
timestamp
string

ISO8601 or unix epoch milliseconds e.g. "2017-03-10T22:21:56+00:00".

idempotency_key
string

A unique ID that will be hashed to Heap's event ID keyspace, to prevent duplication of events

 

Requests are limited to 30 requests per 30 seconds per identity per app_id

Suggest Edits

Add User Properties

You can also assign custom properties to any of your users from your servers.

 
posthttps://heapanalytics.com/api/add_user_properties
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "app_id": "11",
    "identity": "bob@example.com",
    "properties": {
      "age": "25",
      "language": "English",
      "profession": "Scientist"
    }
  }' \
  https://heapanalytics.com/api/add_user_properties
A binary file was returned

You couldn't be authenticated

Try the API to see results

Body Params

app_id
string
required

The app_id corresponding to one of your projects.

identity
string
required

An identity, typically corresponding to an existing user. If no such identity exists, then a new user will be created with that identity. Limited to 255 characters.

properties
object

An object with key-value properties you want associated with the user. Each key and property must either be a number or string with fewer than 1024 characters.

 
 

Requests are limited to 30 requests per 30 seconds per identity per app_id

Suggest Edits

Bulk Track

If you have many custom events to send at once, you can use our bulk Track API.

 
posthttps://heapanalytics.com/api/track
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
  "app_id": "12343283",
  "events": [{
    "identity": "alice@gmail.com",
    "timestamp": "2016-05-10T22:21:56+00:00",
    "event": "Phone Call",
    "properties": {
      "Sales Rep": "Joe Smith",
      "Duration" : "15 minutes",
      "Purpose" : "Discovery Call"
    }
  },
  {
    "identity": "mike@gmail.com",
    "timestamp": "2016-05-10T22:23:56+00:00",
    "event": "Phone Call",
    "properties": {
      "Sales Rep": "Susie Smith",
      "Duration" : "30 minutes",
      "Purpose" : "Discovery Call"
    }
  }]
  }'\
  https://heapanalytics.com/api/track
A binary file was returned

You couldn't be authenticated

Try the API to see results

Body Params

app_id
string
required

The environment ID corresponding to one of your environments.

events
array of objects
required

An array of events where each item in the array is an object containing the following

identity
timestamp
event
idempotency_key
properties 
 

This API is not intended to support large-scale event backfills. Please contact support@heapanalytics.com if you are interested in ingesting past data.

Suggest Edits

Bulk Add User Properties

 
posthttps://heapanalytics.com/api/add_user_properties
curl \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
  "app_id": "12345",
  "users":[{
    "identity": "alice@example.com",
    "properties": {
      "Role": "Admin",
      "Vertical": "Ecommerce"
      }
  },
   {"identity": "bob@example.com",
    "properties": {
      "Role": "User",
      "Vertical": "Saas"
      }
  }]
  }' \
  https://heapanalytics.com/api/add_user_properties
A binary file was returned

You couldn't be authenticated

Try the API to see results

Body Params

app_id
string
required

The app_id corresponding to one of your projects.

users
array of objects
required

Max of 1000 users per request

identity
Properties