To install the SDK, please follow the instructions in the installation  section. 
All methods below are called using the loaded window.gwhale instance. 
init This method needs to be called before calling any other methods below.
Used to initialize GuideWhale app environment and identify user, company and their membership. 
For single page applications (SPA) this method should only be called when page is initially loaded. 
For multipage application this method should be called on every page load 
 
For a detailed parameter guide see the installation  section. 
Code of the app environment to initialize. This can be found in our dashboard under Settings > Environments or Settings > Installation. 
Initialization options, including user, company and membership properties. User verification signature generated by your backend from user_id and app environment secret key. See installation  section for more details. Only required if user.user_id is set and user has given their consent to data collection. If we should consider GDPR consent. Enable this if you’re dealing with users who have not given their consent for data collection. 
When GDPR option is enabled, this field should be set to true if the user has given their consent for data collection. If consent has not been given, user.user_id will be anonymized for each session. 
User identification properties. Unique user identifier. Set to null if you’re dealing with an anonymous user. 
URL of user’s profile image. 
When user has signed up for your application. 
...
string | number | boolean | date 
Any other custom user property you want to add. 
Company identification properties. Unique company identifier. 
URL of company logo image. 
Company’s subscription plan. 
When company has signed up for your application. 
When company’s subscription is set to renew. 
Company’s monthly recurring revenue. 
Number of licenses company has purchased. 
...
string | number | boolean | date 
Any other custom company property you want to add. 
User company membership identification properties. Hide Membership Properties
If user is a primary contact of a company. 
User’s role in a company. 
...
string | number | boolean | date 
Any other custom membership property you want to add. 
gwhale . init ( 'prod-1234abcd' , {     gdpr:  true ,     gdpr_consent:  true ,     signature:  '5e7001282790905aa22523e2c0c5e7cd08046b79fd8546b3bb43a5578704f683' ,     user:  {         user_id:  '123' ,         email:  '[email protected] ' ,         first_name:  'John' ,         last_name:  'Smith' ,         date_signed_up:  '2022-01-01' ,         custom_property:  'value1'     },     company:  {         company_id:  '123' ,         name:  'ACME' ,         plan:  'Enterprise' ,         date_signed_up:  '2022-01-01' ,         date_renewal:  '2025-01-01' ,         mrr:  999 ,         license_count:  10 ,         industry:  'Construction' ,         size:  30 ,         custom_property:  'value1'     },     membership:  {         is_primary:  true ,         role:  'user' ,         custom_property:  'value1'     } }); track Used to programmatically track user events that are not taggable or automatically captured by GuideWhale. 
The name of the event to track. 
Contextual properties associated with this event. 
gwhale . track ( 'item_purchased' , {     name:  'Pro Subscription' ,     price:  1000.0 }); onRedirect Used to handle redirects without a page reload when GuideWhale content wants to redirect to another page. 
handler
(url: string) => void 
required
Handler function to handle redirects without a page reload when GuideWhale content wants to redirect to another page. 
gwhale . onRedirect (( url :  string )  =>  {     navigate ( url ); }); reset Remove currently identified user and company. You will have to call the init function again to re-identify the user. 
setUserProperties Helper function to set user properties of currently identified user without having to call the identify function again. 
gwhale . setUserProperties ({     completed_assignment:  true }); setCompanyProperties Helper function to set company properties of currently identified user without having to call the identify function again. 
gwhale . setCompanyProperties ({     plan:  'Enterprise' }); setMembershipProperties Helper function to set user company membership properties of currently identified user without having to call the identify function again. 
gwhale . setMembershipProperties ({     position:  'Manager' });