This is a Jitsu.Classic documentation. For the lastest version, please visit docs.jitsu.com. Read about differences here.

πŸ“œ Configuration

Configuration UI

πŸ‘©β€πŸ”¬ Extending Jitsu

Overview
Destination Extensions
Source Extensions
API Specs

Jitsu Internals

Jitsu Server

Segment Compatibility

Jitsu can serve as a Segment replacement.

For that, we provide to different approaches:

  • If you're using analytics.js on frontend already, EventNative can intercept all events you send to analytics.js. Check Events Inteception page for more details
  • If you're sending events directly from JS SDK or through API Segment compatible data still can be produced.

For both approaches you'll need to configure Transform. See Mappings for Segment Compatibility section.

Also, you'll need to create a view to mimic Segment's users table. See below

Segment Tables

By default, Segment creates 1 table per 1 event type. For keeping these table names - configure table_name_template (see examples below). Also, Segment creates users table as unique records from identifies table. For keeping it as well - create an SQL view with the following statement:

create view users as
select distinct on (email) _timestamp,
                           context_page_url,
                           context_user_agent,
                           email,
                           name,
                           context_locale,
                           context_page_path,
                           context_page_title,
                           context_ip,
                           context_page_search,
                           context_page_referrer,
                           anonymous_id,
                           user_id,
                           context_campaign_source,
                           context_utm_source
from identifies;

Mappings for Segment Compatibility

If you're using analytics.js on frontend already - EventNative javascript should be configured according to the following javascript reference. If you're sending events directly - EventNative javascript should be set up, tracking event calls should be placed according to your requirements and the destination should contain the following mapping configuration:

Destination configuration should have the following Transform configuration:

destinations:
  example:
    type: ...
    ...
    data_layout:
      transform_enabled: true
      transform: |-
        return toSegment($)

Source code of toSegment transform function can be found here

Version of Jitsu below 1.37.0 must rely on the following mapping configuration instead:

server:
  ...
destinations:
  destination_to_write_segment_data:
    type: ...
    ...
    data_layout:
      table_name_template: |
        switch ($.event_type) {
            case "user_identify":
            case "identify":
                return "identifies";
            case "page":
            case "pageview":
                return "pages";
            default:
                return $.event_type
        }
      mappings:
        #Use true if you would like to have Segment like DB schema + all other fields.
        #Use false for having only Segment data.
        keep_unmapped: false
        fields:
          - src: /src_payload/name
            dst: /name
            action: move
          - src: /src_payload/obj/context/page/title
            dst: /title
            action: move
          - src: /src_payload/obj/context/page/url
            dst: /url
            action: move
          - src: /src_payload/obj/userId
            dst: /user_id
            action: move
          - src: /src_payload/obj/anonymousId
            dst: /anonymous_id
            action: move
          - src: /src_payload/obj/context/library/version
            dst: /context_library_version
            action: move
          - src: /src_payload/obj/context/page/referrer
            dst: /context_page_referrer
            action: move
          - src: /src_payload/obj/context/page/url
            dst: /context_page_url
            action: move
          - src: /src_payload/obj/context/page/userAgent
            dst: /context_user_agent
            action: move
          - src: /src_payload/obj/context/page/referrer
            dst: /referrer
            action: move
          - src: /src_payload/obj/context/page/search
            dst: /context_page_search
            action: move
          - src: /src_payload/obj/timestamp
            dst: /timestamp
            action: move
          - src: /source_ip
            dst: /context_ip
            action: move
          - src: /src_payload/obj/context/library/name
            dst: /context_library_name
            action: move
          - src: /src_payload/obj/messageId
            dst: /id
            action: move
          - src: /src_payload/obj/sentAt
            dst: /sent_at
            action: move
          - src: /src_payload/obj/context/locale
            dst: /context_locale
            action: move
          - src: /src_payload/obj/context/page/path
            dst: /context_page_path
            action: move
          - src: /src_payload/obj/context/page/title
            dst: /context_page_title
            action: move
          - src: /src_payload/obj/traits/name
            dst: /name
            action: move
          - src: /src_payload/obj/traits/email
            dst: /email
            action: move
          - src: /eventn_ctx/utm/campaign
            dst: /context_campaign_source
            action: move
          - src: /app
            dst: /app
            action: move
          - src: /source_ip
            dst: /context_ip
            action: move
          - src: /eventn_ctx/url
            dst: /url
            action: move
          - src: /url
            dst: /url
            action: move
          - src: /eventn_ctx/user/id
            dst: /user_id
            action: move
          - src: /user/id
            dst: /user_id
            action: move
          - src: /eventn_ctx/user/internal_id
            dst: /user_id
            action: move
          - src: /user/internal_id
            dst: /user_id
            action: move
          - src: /eventn_ctx/user_agent
            dst: /context_user_agent
            action: move
          - src: /user_agent
            dst: /context_user_agent
            action: move
          - src: /eventn_ctx/utc_time
            dst: /sent_at
            action: move
          - src: /utc_time
            dst: /sent_at
            action: move
          - src: /eventn_ctx/user_language
            dst: /context_locale
            action: move
          - src: /user_language
            dst: /context_locale
            action: move
          - src: /eventn_ctx/doc_path
            dst: /path
            action: move
          - src: /doc_path
            dst: /path
            action: move
          - src: /eventn_ctx/page_title
            dst: /title
            action: move
          - src: /page_title
            dst: /title
            action: move
          - src: /eventn_ctx/user/anonymous_id
            dst: /anonymous_id
            action: move
          - src: /user/anonymous_id
            dst: /anonymous_id
            action: move
          - src: /eventn_ctx/referer
            dst: /referrer
            action: move
          - src: /referer
            dst: /referrer
            action: move
          - src: /eventn_ctx/user/email
            dst: /email
            action: move
          - src: /user/email
            dst: /email
            action: move
          - src: /eventn_ctx/doc_search
            dst: /search
            action: move
          - src: /doc_search
            dst: /search
            action: move
          - src: /eventn_ctx/utm/source
            dst: /context_utm_source
            action: move
          - src: /utm/source
            dst: /context_utm_source
            action: move