SaaSquatch Help Center

The integration with SaaSquatch makes it easy to send your existing Segment data to SaaSquatch. For further information about our complete integration, review our full 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" for user_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", {
    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
email 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 accountId.

  • Omit this parameter on Payment Provider Integration programs.
  • The default value is TRIAL.
  • Possible values are TRIAL, FREE, FREE, or CANCELLED
  • Can also be updated using the REST API or Squatch.js.
referralCode Optional

The referral code of the person that referred this accountId (i.e. if Bob referred you, this value would be BOB)

  • Do not include when paymentProviderId exists.
  • Automatically filled in the background by Analytics.identify method from browser cookie. (Note: This only works with 3rd party cookies)
  • If someone uses a referral code during checkout, set that value here.
  • Can also be set using the REST API or Squatch.js.
userReferralCode Optional The referral code to be shared by this userId.
  • Used to set a custom referral code for this userId.
  • Defaults to the first 15 alphanumeric characters of the user's first and last names.
  • Limited to 15 characters. Restricted to ASCII character codes 48-57, 65-90, and 97-122.
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 POPUP (default), EMBED and NOCONTENT. Not signed in the checksum.

  • Popup mode (POPUP) requires an element with class="squatchpop" applied to trigger the popup to show
  • Embed mode (EMBED) requires a div with id="squatchembed" to control where the widget is embedded
  • No content mode (NOCONTENT) allows user tracking and does not load any widget
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
    tenantAlias: 'test_abzxg88g30tn2'

var initObj = {

user: {                               
  id: 'u1234',                      
  accountId: 'a5678',       
  email: '',                
  firstName: 'Joe',       
  lastName: 'Tester',
  referralCode: 'JOETESTER',
  paymentProviderId: 'cus_8rVOAthroptvT6',
  locale: 'en_US'
engagementMedium: 'EMBED',


squatch.api().upsertUser(initObj).then(function(response) { user = response.user; }).catch(function(error){ console.log(error); }) });

analytics.identify( "u1234", {
    accountId: "a5678",
    email: "",
    firstName: "Joe",
    lastName: "Tester",
    userReferralCode: "JOETESTER",
    mode: "EMBED",
    locale: "en_US",
    paymentProviderId: 'cus_8rVOAthroptvT6'
    integrations: {
        SaaSquatch: {
            checksum: 'n3VtXg92TVOuzQ+6EMV8FvjY4em5NptCcesDYv+9tegs='

🔗 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.