Skip to main content
How to pass events in your native Wootric SDK installs

Learn about tracking events with the Wootric SDKs

Daniel Pitrowiski avatar
Written by Daniel Pitrowiski
Updated over 2 months ago

Trigger a survey using an event in Targeted Sampling. Below

Events can trigger surveys from your other apps like Salesforce, Zendesk, or other partner integrations. But those integrations will not be covered here.

NOTE: If you've installed Wootric via our Segment integrations events are automatically passed to us and you can trigger surveys based on those.

Prerequisites:

  • Your account must be using Wootric’s Targeted Sampling

  • For JavaScript installations: SDK version 1.1.0 or newer. You can check your version by running WootricSurvey.version() in the browser’s console whenever your Wootric snipped is embedded.

  • For Android installations: version 0.17.0 or newer.

  • For iOS installations: version 2.15.0 or newer.

JavaScript

(1) You define a global variable to track your events.

my_global_event_name = 'loaded_website'; 

(2) You define your WootricSettings variable at the beginning of the code:

wootricSettings = {
account_token: 'NPS-YOURTOKEN',
email: 'user@example.com',
created_at: 1528416000,
properties: {
favorite_color: 'blue'
},
event_name: my_event <<<< define your event name
};

(3) You assign the event name when a given action happens

wootricSettings.event_name = 'on_purchase'

(4) You call Wootric whenever you want to check if the event you set might be eligible for a survey

wootric('run');

iOS

NSString *accountToken = @"ACCOUNT_TOKEN";

[Wootric configureWithAccountToken:accountToken];
[Wootric setEndUserEmail:@"user@example.com"];
[Wootric setEndUserCreatedAt:@1528416000];
[Wootric setEndUserProperties:@{ @"favorite_color": @"blue"}];

[Wootric showSurveyInViewController:self event:@"on_purchase"];

Android

Wootric wootric = Wootric.init(this, CLIENT_ID, ACCOUNT_TOKEN);

wootric.setEndUserEmail("user@example.com");
wootric.setEndUserCreatedAt(1528416000);

HashMap<String, String> properties = new HashMap();
properties.put("favorite_color", "blue");
wootric.setProperties(properties);

wootric.survey("on_purchase");


Questions? Contact support@inmoment.com or create a support ticket here.

Did this answer your question?