---
title: Create custom events (Go)
source: https://docs.newrelic.com/docs/apm/agents/go-agent/features/create-custom-events-go
---

Custom events are useful to explore data for a single event you are interested in, including data from external sources, at a particular moment in time. To track arbitrary [event data](https://docs.newrelic.com/docs/data-analysis/metrics/analyze-your-metrics/data-collection-metric-timeslice-event-data#event-data) for apps monitored by your New Relic Go agent, add `RecordCustomEvent` to the apps. You can then [query and visualize the event data](https://docs.newrelic.com/docs/query-your-data).

## `RecordCustomEvent` parameters [#recordCustomEvent]

To add `RecordCustomEvent` to your Go app, use this format:

```go
RecordCustomEvent(eventType string, params map[string]interface{})
```

| Parameter                                           | Description                                                                                                                                                                                                                                                                                                                                              |
| --------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `eventType` _string_                                | Required. The name of the event type to record. - Must consist of alphanumeric characters, underscores `_`, or colons `:`. - Must contain no more than 255 bytes. - Must follow New Relic data requirements for [names, limits, and restricted characters](https://docs.newrelic.com/docs/insights/insights-data-sources/custom-data/data-requirements). |
| `params map` `_number_`, `_string_`, or `_boolean_` | Required. Specify key/value pairs of attributes to annotate the event. - Each value in the `params map` must be a number, string, or boolean. - Keys must be less than 255 bytes. - The `params map` must not contain more than 64 attributes.                                                                                                           |

## Example

Here is an example of a custom event for a Go app:

```go
func customEvent(w http.ResponseWriter, r *http.Request) {
    io.WriteString(w, "recording a custom event")

    app.RecordCustomEvent("my_event_type", map[string]interface{}{
        "myString":  "hello",
        "myFloat":   0.603,
        "myInt":     123,
        "myBool":    true,
    })
}
```
