---
updatedAt: 2025-06-17T21:37:34.000Z
agentTools:
  projectIndex: https://support.kissmetrics.io/llms.txt
---

# Sending Custom Channel Data to Kissmetrics

In addition to the [**Channel**](https://support.kissmetrics.io/docs/channel-definitions) traffic data that we collect and calculate automatically, you can send over a **Custom Channel** information as [event with property](https://support.kissmetrics.io/docs/understanding-people-events-and-properties-within-kissmetrics) via JS APIs. The following example captures values for a custom property called `custom_channel` which are passed via a query-string parameter in the URL. This is a common practice when the user is coming from a different domain or when the user is clicking a link embedded in an email, and you’d like to track additional data once the user lands on your site.

## I. Using Kissmetrics JS APIs

```ruby Example URL
http://127.0.0.1:5500/index.html?custom_channel=unique
```

```javascript KM JS API
const params = new URL(location.href).searchParams;
const isTrackable = params.has("custom_channel");
const customChannel = params.get("custom_channel");

params.delete("custom_channel");

if (window._kmq && isTrackable && customChannel) {
  window._kmq.push(["record","Custom traffic", //Custom traffic is an example event name, you are free to adjust it.
      "custom channel": customChannel,
    {
      "custom channel": customChannel, //customChannel = unique from the URL
    },
  ]);
} else {
  console.error("Kissmetrics snippet not loaded or no required search params");
}
```

**Result in Kissmetrics:**

![1209](https://files.readme.io/ab9fce4-01_Custom_channel_Kissmetrics_API.png "01_Custom_channel_Kissmetrics_API.png")

## II. Using Segment's APIs

```ruby Example URL
http://127.0.0.1:5500/index.html?custom_channel=unique
```

```javascript Segment JS API
const params = new URL(location.href).searchParams;
const isSegmentTrackable = params.has("custom_channel");
const customChannel = params.get("custom_channel");

params.delete("custom_channel");

if (window.analytics) {
  window.analytics.initialize({
    KISSmetrics: {
      apiKey: "<REDACTED>",
    },
  });

  window.analytics.page();

  if (isSegmentTrackable && customChannel) {
    window.analytics.track("Segment traffic", { //Segment traffic is an example event name, you are free to adjust it.
      "custom channel": customChannel, //customChannel = unique from the URL
    });
  }
} else {
  console.error("Segment snippet not loaded");
}
```

**Result in Kissmetrics:**

![1209](https://files.readme.io/8a80bca-02_Custom_channel_Segment_API.png "02_Custom_channel_Segment_API.png")