Segment Integration Reference
The Segment.com integration with SaaSquatch makes it easy to send your existing Segment data to SaaSquatch. For further information about our complete integration, review our full Segment.io Guide.
Source / Stream | Destination / Subscription | |
---|---|---|
Segment Integration Documentation |
This reference outlines the functionality of the Segment Integration that allows you to send data from Segment to your SaaSquatch program. It includes details about the structure of the method, available parameters, limitations, and examples.
🔗 How do I use the Segment integration?
Segment customers can use the Segment analytics.js library instead of directly using the squatch.js SaaSquatch javascript library.
Use the analytics.js identify method instead of squatch.js userUpsert
call to identify, attribute, and convert users in your SaaSquatch program.
🔗 What features are supported with Segment?
Most of the features of the SaaSquatch squatch.js library are available through this Segment Integration. However, there will always be some things that will require you to use squatch.js directly.
🔗 Signed Requests
The Segment Integration supports Signed Requests using checksums.
Please be aware of the following differences:
The structure and contents of the checksum being generated is based on that of the equivalent squatch.js call.
- Ordering of parameters when generating the checksum is based upon squatch.js
userUpsert
parameters names, not the analytics.js parameter names. For example,avatar
should still be sorted with "u" foruser_image
. - Omit other analytics.js traits from the checksum, such as Google Analytics IDs.
🔗 SaaSquatch REST API
At this time the Segment integration with SaaSquatch is only an abstraction of the squatch.js javascript library.
🔗 Identify Method Reference
The Segment analytics.js library identify method is used to connect with your SaaSquatch.
🔗 Structure
The Segment analytics.identify method is structured differently than the SaaSquatch squatch.js userUpsert
call.
Unlike the squatch.js userUpsert
call, in the analytics.identify method the userId
and the tenantAlias
are not listed among the regular parameters.
tenantAlias | Required |
Identifies which program tenant to connect to. Your program has two tenant aliases -- one for Test mode and one for Live mode. Test mode alias are prefixed with test_ , for example test_abhoihnqwet The tenantAlias is set in the SaaSquatch Integration settings in the Segment portal.
|
---|---|---|
userId | Required | A user ID from your system (must be unique for every user). We use this to uniquely track users, and lets us handle accounts that are shared between users. The userId is used as the analitics.identify userId rather than a trait like the other parameters. |
🔗 Example
The following example highlights the structure of the analytics.identify method with no parameters:
analytics.identify( "userId", {
/*
PARAMETERS GO HERE
*/
},{
integrations: {
SaaSquatch: {
checksum: null
}
}
});
🔗 Parameters
accountId | Required |
We use accountId to link a group of users together. See Shared vs Solo Accounts to see what you should use here.
|
---|---|---|
firstName | Required | The user's first name |
lastName | Optional | The user's last name |
Optional | The e-mail address of the user. We use this to contact the user when someone they referred signs up or pays. | |
avatar | Optional | Defaults to Gravatar or, if unavailable, the user's initials. If you provide a absolute profile image URL the minimum image size is 80px x 80px. Requires Signed Requests. |
paymentProviderId | Required |
Unless explicitly setting this field it should be left as 'null' . On payment provider programs this can be set to the Stripe Customer ID, Recurly Account ID, Braintree Account ID, or the Zuora Account ID.
|
accountStatus | Optional |
The status of the account identified by
|
referralCode | Optional |
The referral code of the person that referred this
|
userReferralCode | Optional |
The referral code to be shared by this userId .
|
locale | Optional | The user's locale, used for Internationalization. The locale must be of the format language_COUNTRY where the language code must be lowercase and the country code must be uppercase. The separator must be an underscore.
Examples: en_US or zh_CN |
mode | Optional |
Sets the mode in which the widget is displayed. Valid options are
|
checksum | Optional | A HMAC-SHA2 checksum that is used to validate that data originated from your servers. For details, see the Signed Requests documentation. |
🔗 Example
Below is a comparison of a squatch.js init call vs the equivalent Segment analytics.js identify call.
Referral SaaSquatch - squatch.js | Segment - analytics.js |
---|---|
Use squatch.js init | Use analytics.js identify |
|
|
🔗 Additional Resources
Segment provides support documents about their integration with SaaSquatch.
You can also check out the full source code for the integration on Segment's Github.
You can also checkout our full Segment Guide.
Details about squatch.js can be found in our squatch.js Quickstart as well as in the squatch.js reference.