# Kissmetrics

[Kissmetrics](https://www.kissmetrics.io/) is a product analytics platform to help you increase conversion, as well as drive customer engagement and retention.

RudderStack supports sending your events from cloud mode S2S \(Server to Server\) and Web Native SDKs by calling our APIs.

Find the open source transformer code for this destination in the [GitHub repository](https://github.com/rudderlabs/rudder-transformer/tree/main/src/v0/destinations/kissmetrics).

## Connection compatibility

{{< destination-config >}}

{{< info >}}
In the web device mode integration, that is, using [JavaScript SDK]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/_index.md" >}}) as a source, RudderStack loads the Kissmetrics native SDK from the`https://kissmetrics.com` domain.

Based on your website's content security policy, you might need to [allowlist this domain]({{< ref "sources/event-streams/sdks/rudderstack-javascript-sdk/load-js-sdk.md#allowlist-destination-domain" >}}) to load the Kissmetrics SDK successfully.
{{< /info >}}

## Get started

Once you have confirmed that Kissmetrics supports the source type, perform the steps below:

- From your [RudderStack dashboard](https://app.rudderlabs.com/), add the source and select **Kissmetrics** as a destination.
- Give a name to your destination, and then click **Next**. You should see the following screen:

{{< image src="images/image (24) (1) (1).webp"  >}}

- Please enter the **API Key** in the **Connection Settings**. You may also enable the **Use native SDK to send events** setting to send events via [device mode]({{< ref "destinations/rudderstack-connection-modes.md#device-mode" >}}), through Kissmetrics' native JavaScript SDK.

### Prefix Properties

Enabling this setting will add the event name to all properties of the event. This works for `page` **and** `track` properties.

{{< info >}}

You will need to enable this setting while building reports in Kissmetrics.
{{< /info >}}

- Once you have finalized the settings, click **Next** to complete the configuration and add Kissmetrics as a destination in RudderStack.

## Identify

Calling `rudderanalytics.identify()` pushes an `identify` call with the `userId` and `set` with the `user-traits` to the Kissmetrics queue object while using the the Native SDK. For more information on the `identify` call, please refer to our [RudderStack Events Specification]({{< ref "event-spec/standard-events/_index.md" >}}) documentation.

For sending data through the API's cloud mode, we call the `http://trk.kissmetrics.com/s` end-point for registering users and their traits.

A sample `identify` call is as shown:

```javascript
// a sample identify
rudderanalytics.identify("my-userID", {
  name: "Tintin",
  city: "Brussels",
  country: "Belgium",
  email: "tintin@herge.com"
});
```

will pass the following to the `_kmq kissmetrics` object.

```javascript
['identify', 'my-userID']
['set',
  {
    name: "Tintin",
    city: "Brussels",
    country: "Belgium",
    email: "tintin@herge.com"
  }
]
```

{{< info >}}

Nested objects are flattened as `a.b.c` for input data `{a:{b:c}}` before sending the data to Kissmetrics, as it is unable to parse nested objects.
{{< /info >}}

## Page

Calling `rudderanalytics.page()` will record the page properties for event `Viewed <category> <name> page`. For more information on the `page` call, please refer to our [RudderStack Events Specification]({{< ref "event-spec/standard-events/_index.md" >}}) documentation.

A sample page event is as shown:

```javascript
// "home" is the name of the page.
rudderanalytics.page("home", {
  path: "path",
  url: "url",
  title: "title",
  search: "search",
  referrer: "referrer"
});
```

The above snippet will pass the following to the `_kmq kissmetrics` object:

```javascript
['record', 'Viewed home page',  {
  path: "path",
  url: "url",
  title: "title",
  search: "search",
  referrer: "referrer"
}]
```

{{< info >}}

 Automatically-tracked Kissmetrics events such as **Visited a site**, etc. will function as and when integrated with RudderStack. Stay tuned!
{{< /info >}}

## Track

Calling `rudderanalytics.track()` pushes a record with the event name and the associated properties \_\_when using the native SDK integration. For more information on the `track` call, please refer to our [RudderStack Events Specification]({{< ref "event-spec/standard-events/_index.md" >}}) documentation.

For sending data through the API's cloud mode, we call the [http://trk.kissmetrics.com/e](http://trk.kissmetrics.com/e) end-point for registering the event and its associated properties.

A sample `track` call is as shown:

```javascript
rudderanalytics.track("Track me", {
  category: "category",
  label: "label",
  value: "value",
});
```

will pass the following to the `_kmq kissmetrics` object.

```javascript
['record', "Track me", {
  category: "category",
  label: "label",
  value: "value"
}]
```

An event sent to RudderStack with a property called `revenue` , is passed on to Kissmetrics as `Billing amount` as well as `revenue`.

{{< info >}}

In order to send ecommerce events that have a product array as one of their `track` properties, RudderStack sends each product property to the `/s` endpoint from cloud mode, or pushes it as `['set', {id:, sku: ...}]` from the native SDK.
{{< /info >}}

## Alias

Calling `rudderanalytics.alias()` passes an `alias`call with `userId` and `previousId` to the Kissmetrics queue, when used as a Native SDK integration.

While passing data using cloud mode, we call the [http://trk.kissmetrics.com/a](http://trk.kissmetrics.com/a) endpoint to alias user identities.

The following code snippet shows a sample `alias` call in RudderStack:

```javascript
// assuming the previous set userId was "my-userID"
rudderanalytics.alias("my-new-userID");
```

will pass the following to the `_kmq kissmetrics` object.

```javascript
['alias', "my-new-userID", "userId"]
```

## Screen

The `screen` call records the screen views of the user in your App. If you have turned on the screen views in your App implementation from the [iOS (Obj-C)]({{< ref "sources/event-streams/sdks/rudderstack-ios-sdk/_index.md" >}}) or [Android (Java)]({{< ref "sources/event-streams/sdks/rudderstack-android-sdk/_index.md" >}}) SDK it will register in your dashboard. RudderStack forwards the `properties` you've passed along with the `screen` call as is.

Here is a sample `screen` call in using RudderStack iOS (Obj-C) SDK:

```javascript
[[RudderClient sharedInstance] screen:@"Main"
            properties:@{@"prop_key" : @"prop_value"}];
```

## FAQ 

#### Where do I get the API Key for Kissmetrics?

You can obtain the Kissmetrics API Key by logging into your Kissmetrics account, and navigating to the **Product Settings**. Please refer to the following screenshot for more details:

{{< image src="images/image (13) (2).webp"  >}}<span class="imageTitle">Kissmetrics API Key</span>



