Skip to main content

Can I set up my own analytics to track views of event details pages?

Analytics tracking

Support avatar
Written by Support
Updated over 9 months ago

Currently there are two CitySpark javascript events that get triggered on the page that can be used for your own analytics or to track user behavior on your site.

The "cityspark.details" event is triggered whenever a details page is opened, and it is passed certain information about the event (title, start, categories, etc). Below is a script example that you can add to your page to listen for the event and log information from it to the console.

```
document.addEventListener("cityspark.search", (data) => {
console.log({msg:"Search", data:data});
//this is where you would also make a call to your own analytics if
//you wanted to track details page views
});
```

The "cityspark.search" event is triggered whenever a search is performed by the user. The search terms and details changed from the default are passed into the event as well.


```
document.addEventListener("cityspark.details", (data) => {
console.log({msg:"Details", data:data});
});

```

Did this answer your question?