window.jitsuConfig object before inserting the snippet. Properties
of the object be same as data attributes, but camel cased and without data- prefix:
```html
```
### Google Tag Manager
Google Tag Manager [strips `data-` attributes](https://support.google.com/tagmanager/thread/18040523/what-attributes-are-preserved-on-custom-html-tags-and-what-attributes-are-stripped?hl=en) from the script tag. To configure Jitsu in GTM, you can use
following snippet:
```html
```
### `onload` hook
You can specify a piece of code that will be executed after the script has loaded. This can be useful if you
want to send additional events or identify user. Example:
```html
```
### Jitsu Processing Queue
Sometimes you may want to send events to Jitsu when it's not guaranteed that Jitsu is initialized. For that case,
you can use `window.jitsuQ` object:
```javascript
(window.jitsuQ = window.jitsuQ || []).push(function(jitsu) {
//send events to Jitsu here
jitsu.page();
});
```
## Sending Events to Jitsu
`window.jitsu` object implements standard [Analytics.js](https://getanalytics.io/api/) interface. See a full list of methods in [JavaScript Reference](/docs/sending-data/js-reference) section
---
Source: https://jitsu.com/docs/sending-data/http
# HTTP API
You can use HTTP API to send data to Jitsu.
This is useful if you want to send data from your backend.
:::tip
In all examples below, replace `your-jitsu-domain.com` with your Jitsu installation domain, or domain linked to your Jitsu Cloud account.
Jitsu Cloud users may find domain in the top-right corner of Site's **Setup Instruction** page or
attach custom domain for a specific Site and use it instead.
:::
## Authorization
### Write Key authentication
Use `X-Write-Key` header to authenticate requests. The header should contain the write key of the site.
### Basic authentication
Jitsu also supports basic authentication in the form of a base64 encoded `username:password` string.
Where **Write Key** must be provided as the `username` and the `password` field is left empty. E.g.: `writeKey123:` - despite empty password, the colon `:` is still required.
After base64 encoding `writeKey123:` becomes `d3JpdGVLZXkxMjM6Cg==` and this is passed in the authorization header like so: `Authorization: Basic d3JpdGVLZXkxMjM6Cg==`.
### Query parameter
You can also pass the `writekey` as a query parameter. This is useful for testing purposes, but not recommended for production use.
`https://your-jitsu-domain.com/api/s/{event-type}?writekey=keyId:keySecret`
## Ingest endpoint
This endpoint can be used to send events to Jitsu:
`https://your-jitsu-domain.com/api/s/{event-type}`
Can be used both for browser and server-to-server events depending on Write Key type.
**event-type** could be:
* `page`, `track`, `identify` or `group`
* Use `event` as `event_type` if you want server to take actual event type from `type` field of the event payload
The endpoint accepts POST requests with events payload in JSON format.
### Examples
8443 by default ) should be open in your ClickHouse server.
:::
**Warehouse type:**
```typescript
interface Warehouse {
query: (sql: string, params?: Record{'http://your-domain:3049'}.
docker/README.md for the defaults.
true if you don't want to allow new users to sign up.
INGEST_REPOSITORY_URL is an URL of console's export endpoint that returns configuration of `streams-with-destinations` entities:
https://$console-endpoint/api/admin/export/streams-with-destinations.
INGEST_REPOSITORY_AUTH_TOKEN is used to authorize request to console. It must start with service-admin-account: prefix.
E.g.: service-admin-account:console-token
See also CONSOLE_AUTH_TOKENS of console configuration
INGEST_REPOSITORY_URL.
host:port.
{'{"mechanism": "SCRAM-SHA-256", "username": "user", "password": "password"}'}
URL template of function servers managed
by the Operator. The default value matches the Kubernetes services the Operator creates.
Used for running functions of device destinations. Replaces INGEST_ROTOR_URL of previous Jitsu versions.
Used to authorize HTTP-requests to function servers.
See ROTOR_AUTH_TOKENS, ROTOR_TOKEN_SECRET and ROTOR_RAW_AUTH_TOKENS in the Rotor section
clickhouse.example.com:9440
INGEST_FAILOVER_LOGGER_ENABLED - falseINGEST_FAILOVER_LOGGER_ROTATION_PERIOD_MINUTES - 60INGEST_FAILOVER_LOGGER_MAX_SIZE_MB - 100INGEST_FAILOVER_LOGGER_COMPRESS - trueINGEST_FAILOVER_LOGGER_BASE_PATH - /tmp/kafka_failoverINGEST_FAILOVER_LOGGER_LOCAL_MAX_OLD_FILES - 10rotor (Kafka consumer, the main event pipeline), functions (function
server — set by the Operator) or profiles (profile builder server).
fetch() calls made from user functions.
ROTOR_AUTH_TOKENS is a list of hashed auth tokens that authorizes user in HTTP interface separated by comma. Each must have format:
$salt.$hash where $salt should be random string. Hash is hex(sha512($token + $salt + ROTOR_TOKEN_SECRET).
To hash token, use following command in the root of this repository: pnpm install && ROTOR_TOKEN_SECRET=xxxx pnpm tool:hash $token
ROTOR_RAW_AUTH_TOKENS can be used instead of ROTOR_AUTH_TOKENS to provide a comma-separared list of raw takens instead of hases. It offers simplicity at cost of
lower security.
REPOSITORY_BASE_URL is an URL of console's export endpoint that returns configuration of `streams-with-destinations` entities:
https://$console-endpoint/api/admin/export.
REPOSITORY_AUTH_TOKEN is used to authorize request to console. It must start with service-admin-account: prefix.
E.g.: service-admin-account:console-token
See also CONSOLE_AUTH_TOKENS of console configuration
clickhouse.example.com:9440
Only HTTP(s) protocol is supported.
BULKER_URL is an URL of Bulker service. Rotor will use it to send event intended to warehouse destinations
BULKER_AUTH_KEY is user to authentificated HTTP-request to Bulker. Should be one of{" "}
BULKER_AUTH_KEYS you configured in Bulker
host:port.
KAFKA_SSL_CA is a certificate in PEM format, KAFKA_SSL_CA_FILE is a path to the file with the certificate.
{'{"mechanism": "SCRAM-SHA-256", "username": "user", "password": "password"}'}
MongoDB is used for Functions Persistent Storage and Identity Stitching.
The value starts with mongodb:// and has the following format: mongodb://$user:$password@$host:$port/$database
To smoothly migrate from REDIS_URL you need to set REDIS_URL and MONGODB_URL at the same time.
Rotor will look for records both in MongoDB and Redis, but new records will be added only to MongoDB.
When you are sure that MongoDB is populated with enough data, you can remove REDIS_URL from the configuration.
redis://: redis://$user:$password:localhost:6379.clickhouse destination is supported.{" "}
If you don't want to send metrics, you can skip this option.
MESSAGES_RETRY_COUNT is 3 and base is 10, then retry delays will be 10, 100, 1000 minutes
MAXMIND_LICENSE_KEY, from custom `MAXMIND_URL` or from S3 or compatible storage.
text or json
https://your-domain/
CONSOLE_AUTH_TOKENS is a list of hashed auth tokens that authorizes user in HTTP interface separated by comma. Each must have format:
$salt.$hash where $salt should be random string. Hash is hex(sha512($token + $salt + CONSOLE_TOKEN_SECRET).
To hash token, use following command in the root of this repository: pnpm install && CONSOLE_TOKEN_SECRET=xxxx pnpm tool:hash $token
CONSOLE_RAW_AUTH_TOKENS can be used instead of CONSOLE_AUTH_TOKENS to provide a comma-separared list of raw takens instead of hases. It offers simplicity at cost of
lower security.
PostgreSQL connection string. postgres://$user:$password@localhost:$port/database?sslmode=no-verify&schema=newjitsu
schema must be newjitsu, and sslmode must be no-verify
BULKER_URL is an url of Bulker service. Used for pulling event logs. E.g.: https://bulker.your-domain.com
BULKER_AUTH_KEY is used to authorized HTTP-request to Bulker. See BULKER_AUTH_TOKENS, BULKER_TOKEN_SECRET and BULKER_RAW_AUTH_TOKENS
in Bulker configuration
ROTOR_URL is an url of the Rotor service. E.g.: http://rotor:3401
ROTOR_AUTH_KEY is used to authorized HTTP-request to Rotor. See ROTOR_AUTH_TOKENS, ROTOR_TOKEN_SECRET and ROTOR_RAW_AUTH_TOKENS in the Rotor section
To enable GitHub OAuth for Jitsu.
You'll need to create a GitHub OAuth application to get those values:
Application name.Homepage URL and Authorization callback URL with value of JITSU_PUBLIC_URL.Register application button.Generate a new client secret button.Client ID and Client Secret values to .env file to GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET variables respectively.To enable OpenID Connect based authentication for Jitsu.
Expected json object with the following properties: issuer (the issuer domain in valid URL format), clientId, and clientSecret
The well-known configuration endpoint for the provider is automatically set based on the issuer, and the default authorization request includes scopes for OpenID, email, and profile information.
Auth0 Example: {'{"issuer":"https://{yourDomain}.us.auth0.com/","clientId":"***","clientSecret":"***"}'}
Optionally scopes the auth session cookie (jitsu-auth) to a parent domain so that sibling apps running on its
subdomains can read the logged-in session. Example: jitsu.com makes the cookie available to use.jitsu.com,
app.jitsu.com, etc.
If not set, the cookie is scoped to the Console's own host (e.g. use.jitsu.com) and is shared with that host's subdomains.
Security: widening the cookie to a parent domain shares the session across all of that domain's subdomains — only set this to a domain you fully control.
INGEST_PUBLIC_URL param of `ingest` service for details.
true enables Connectors Syncs feature in Jitsu Console UI. Requires syncctl service.
Scheduled syncs are managed by syncctl as Kubernetes CronJobs — no external scheduler is needed
(the GOOGLE_SCHEDULER_KEY variable of previous Jitsu versions was removed).
SYNCS_ENABLED=true. SYNCCTL_URL is an URL of the main endpoint of Syncctl service. SYNCCTL_AUTH_KEY is Syncctl service authentication key: one
of SYNCCTL_AUTH_KEYS or SYNCCTL_RAW_AUTH_TOKENS configured in Syncctl
free (shared,
sharded function-server deployments) or dedicated (one deployment per workspace).
See the Operator section.
Maintenance mode: a JSON descriptor that switches the console API to read-only mode and shows a
maintenance page. MAINTENANCE takes the JSON inline; MAINTENANCE_CONFIG_FILE takes a path
to a JSON file (e.g. a mounted ConfigMap), so the mode can be toggled without restarting the console.
Replaces the JITSU_CONSOLE_READ_ONLY_UNTIL variable of previous Jitsu versions.
MINUTE_RATE_LIMIT_ENABLED=true); MINUTE_RATE_LIMIT_BASE (default 60) is the base
per-minute budget from which limits per auth type and HTTP method are derived.
true, rejects signups with personal email addresses (gmail.com, etc.) — a work
email is required.
clickhouse.example.com:9440
Only HTTP(s) protocol is supported.
jitsu_cluster
SMTP_CONNECTION_STRING is a connection string to SMTP server in format: smtp://user:password@localhost:587EMAIL_TRANSACTIONAL_SENDER is an email address that will be used as sender.EMAIL_TRANSACTIONAL_REPLY_TO (optional) is an email address that will be used as Reply-To.BCC_EMAIL (optional) is an email address where all emails will be sent as BCC.
text or json
A list of hashed auth tokens that authorizes user in HTTP interface separated by comma. Each must have format:
$salt.$hash where $salt should be random string. Hash is hex(sha512($token + $salt + SYNCCTL_TOKEN_SECRET). $token must consist only of letters, digits, underscore and dash
SYNCCTL_RAW_AUTH_TOKENS can be used if you want to provide a comma-separared list of raw takens instead of hases. It offers simplicity at cost of lower security.
PostgreSQL connection string. postgres://$user:$password@localhost:$port/database?sslmode=no-verify&search_path=newjitsu. Should be the same as DATABASE_URL for console
search_path must be newjitsu, and sslmode must be no-verify
SYNCCTL_DATABASE_URL. E.g. if you use localhost in SYNCCTL_DATABASE_URL
syncctl service itself runs in kubernetes cluster, you can skip this option or use local value.
SYNCCTL_REPOSITORY_BASE_URL is the URL of the console's export endpoint:
https://$console-endpoint/api/admin/export. Syncctl polls the syncs export and
reconciles Kubernetes CronJobs (one per scheduled sync, named sync-<syncId>) to match the
configured schedules. If not set, scheduled syncs are not managed — only ad-hoc runs work.
SYNCCTL_REPOSITORY_AUTH_TOKEN is used to authorize requests to console. It must start with the
service-admin-account: prefix. E.g.: service-admin-account:console-token
180000), Kubernetes retry limit for failed
jobs (default 0) and maximum random start jitter in seconds (default 60).
3000) and retention in days
(default 60). These settings were moved from console to syncctl.
text or json
/health, /ready, /status).
OPERATOR_REPOSITORY_BASE_URL is the URL of the console's export endpoint:
https://$console-endpoint/api/admin/export. The operator polls workspaces, connections and
functions from it.
OPERATOR_REPOSITORY_AUTH_TOKEN is used to authorize requests to console. It must start with the
service-admin-account: prefix.
FunctionsServer table there.
local — in-cluster
config), context name, and the namespace where function-server deployments are created.
ROTOR_MODE=functions.
FUNCTIONS_SERVER_URL_TEMPLATE configured on
Rotor, Ingest and Console.
free (shared, sharded
deployments) or dedicated (one deployment per workspace).
free class (default
1) and minimum replicas per deployment (default 2).
16; target CPU utilization 100).
mongobetween connection-pooling sidecar to each function-server pod.
ADMIN_REPOSITORY_URL is an URL of console's export endpoint that returns configuration of `streams-with-destinations` entities:
https://$console-endpoint/api/admin/export/streams-with-destinations.
ADMIN_REPOSITORY_AUTH_TOKEN is used to authorize request to console. It must start with service-admin-account: prefix.
E.g.: service-admin-account:console-token
See also CONSOLE_AUTH_TOKENS of console configuration
ADMIN_REPOSITORY_URL.
host:port.
{'{"mechanism": "SCRAM-SHA-256", "username": "user", "password": "password"}'}