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

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

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}];
Arguments
  1. event name: name of the custom interaction. Limited to 1024 characters.
  2. event properties: a JSON object or NSDictionary containing key-value pairs to be associated with an event. Keys and values must be a number or string with fewer than 1024 characters.

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

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;

// Exampe
[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.

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"}];
Arguments
  1. user properties: an object containing string 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.

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.

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"}];
Arguments
  1. event properties: a JSON object or NSDictionary containing key-value pairs to be associated with every subsequent event. Keys and values must be a number or string fewer than 1024 characters.

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"];
Arguments
  1. event property: name of the event property to remove. This stops attaching the property to all subsequent events.

clearEventProperties

Removes all stored event properties.

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

// Example
[Heap clearEventProperties];

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];

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

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

Track

 
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.

timestamp
string

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

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.

 
properties.
string
 

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.

 
properties.
string
 

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
properties 
 

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
identity
Properties