---
title: Define custom activities in Xperience
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

You may encounter use cases where you need to track visitor actions not covered by out-of-box options, or where you need to track additional details. Xperience allows you to define custom activities, which can then be logged through both client-side and server-side code.

Let's dive into the process of logging a custom activity when a visitor downloads a file using JavaScript, and logging a custom activity when a user clicks a like button using C#.

## Create custom activity types

The first step to logging custom activities is to create the activity types that represent them.

In the Xperience administration interface, navigate to the **Activity types** tab of the **Contact management** application and define activity types with the following values.

- Activity 1:
  - **Display name**: File Download
  - **Code name**: filedownload
  - **Description**: The visitor downloaded a file.
  - **Enabled:** True
- Activity 2:
  - **Display name**: Page like
  - **Code name**: pagelike
  - **Description**: The visitor clicked a like button on a page.
  - **Enabled:** True

Let's explore two different approaches for logging custom activities, using one for each of the types we just defined.
