Skip to main content

CitySpark Portal Analytics Events

Written by Jenny Limb

CitySpark Portal Analytics Events

The CitySpark Portal provides three browser CustomEvent events that allow your website to track user activity using your own analytics platform. These events work with tools such as Google Analytics 4 (GA4), making it easy to track event details and searches as virtual page views within a single-page application (SPA), and outbound clicks as separate interactions.

Important: Register your event listeners before the CitySpark Portal JavaScript loads, or as early as possible during page initialization, to ensure events are captured.

Available Analytics Events

Event

Trigger

cityspark.details

A visitor opens an event's details view and the event has loaded successfully, or returns to a cached details view.

cityspark.search

A visitor changes search criteria using the Portal and the search route is updated.

cityspark.outclick

A visitor activates a tracked event link or social link on the details page.

All three events are dispatched on the browser's document object. Read their properties from event.detail.

Event Detail Tracking (cityspark.details)

The cityspark.details event fires after an event has been successfully loaded into the Portal's Event Details view. It also fires when a visitor returns to a cached details view.

This allows your analytics platform to record an event details view as a virtual page view.

Event Properties

Property

Description

name

The name of the event.

cityState

The city and state where the event takes place.

categoryTags

The event's category/tag IDs, as an array of numbers.

start

The event start date and time, as provided by the Portal.

venue

The venue where the event is held.

sessionViewCount

The view count associated with the current details view in the running Portal.

Session View Count

The first successful event load reports sessionViewCount: 1. Returning to the same cached details view can report 2, 3, and so on.

This is an in-memory Portal view count, not a persistent visitor identifier or a site-wide per-event counter. Loading event details afresh resets the reported count to 1; a full page reload also starts a new Portal instance. Use your analytics platform's own session and visitor measurements for durable reporting.

Google Analytics 4 Example

<script>
document.addEventListener('cityspark.details', function (event) {
const details = event.detail;
const virtualPath = '/events/' + encodeURIComponent(details.name);

gtag('event', 'page_view', {
page_path: virtualPath,
page_title: details.name,
event_category: details.categoryTags ? details.categoryTags.join(',') : undefined,
event_label: details.venue || undefined,
city_state: details.cityState || undefined,
event_start: details.start || undefined,
session_view_count: details.sessionViewCount
});
});
</script>

This example assumes your website has initialized the Google Analytics gtag() function. The name-based virtual path is illustrative, not a unique event identifier: events with the same name share this path. Adapt your reporting scheme if you need to distinguish them. The same browser event information can be sent to other analytics providers using their own APIs.

Event Search Tracking (cityspark.search)

The cityspark.search event fires when a visitor changes search filters within the Portal and the search route is updated.

This allows search activity to be recorded as virtual page views.

Event Properties

Only non-default search values are included. Possible properties are:

Property

Description

search

Search text.

start

Selected start date.

end

Selected end date.

location

Selected location.

page

Search page value.

pick

Pick filter value.

sparks

Sparks filter value.

virtual

Virtual-event filter value.

subset

Selected event subset.

distance

Search distance.

category

Selected category IDs, as a comma-separated string.

view

Selected view.

Unlike the details and outclick categoryTags array, the search event's category property is a comma-separated string.

Google Analytics 4 Example

<script>
document.addEventListener('cityspark.search', function (event) {
const query = event.detail;
const searchParams = new URLSearchParams();

Object.entries(query).forEach(function ([key, value]) {
if (value !== undefined && value !== null && value !== '') {
searchParams.set(key, String(value));
}
});

gtag('event', 'page_view', {
page_path: '/events/search?' + searchParams.toString(),
page_title: 'Event Search',
search_term: query.search || undefined,
event_category: query.category || undefined,
location: query.location || undefined,
view_type: query.view || undefined
});
});
</script>

Search Event Limitations

The cityspark.search event is not triggered for every Portal API request. It does not fire solely because:

  • The initial Portal URL is loaded.

  • Additional search results are loaded, such as a "Load More" action.

  • A background API request occurs without a search route change.

Outbound Link Tracking (cityspark.outclick)

The cityspark.outclick event fires when a visitor activates a tracked link on an event's details page. It includes the same event information as cityspark.details, plus the clicked destination and link type.

Outclicks are interactions, not virtual page views. They report the click, not successful arrival at the destination, a completed ticket purchase, or a completed social share. They do not prevent normal link navigation.

Event Properties

Property

Description

name

The name of the event.

cityState

The city and state where the event takes place.

categoryTags

The event's category/tag IDs, as an array of numbers.

start

The event start date and time.

venue

The venue where the event is held.

sessionViewCount

The current details view's most recently reported count. Clicking links does not increment it.

link

The clicked anchor's resolved destination, including generated share URLs or a mailto: destination for email sharing.

type

One of EventUrl, TicketUrl, MoreInfoUrl, or SocialShare, as described below.

shareType

Present only for SocialShare; identifies the social platform or sharing channel.

Link Types

type

Tracked links

EventUrl

"Visit Event Website".

TicketUrl

Primary and secondary/reseller ticket links in "Ticket Options". Opening the dropdown alone does not count.

MoreInfoUrl

Links in "More Info", including the Bandsintown logo link.

SocialShare

"Share this event" destination buttons and the event's own social-profile links.

For "Share this event" buttons, shareType is Facebook, X, Bluesky, LinkedIn, or Email. For event social-profile links, it is the platform name stored on the event, such as Instagram or Spotify. Both groups use SocialShare; that type does not imply that a visitor actually shared the event.

Map/directions links, links embedded in event descriptions, admin source links, and embed/copy actions are not included. Interactions inside third-party embedded media players are not tracked by this event.

The event is dispatched for normal link activation, including a keyboard-generated click or a Ctrl/Cmd-click. Opening a link through a context menu or a middle-button action does not dispatch a normal click and is not included.

Example Payload

{
"name": "Summer Concert",
"cityState": "Denver, CO",
"categoryTags": [10, 20],
"start": "2026-07-10T19:00:00",
"venue": "City Park",
"sessionViewCount": 1,
"link": "https://tickets.example.com/summer-concert",
"type": "TicketUrl"
}

A social action includes "type": "SocialShare" and, for example, "shareType": "Facebook", with link set to the clicked share or profile destination. Other types omit shareType.

Google Analytics 4 Example

<script>
document.addEventListener('cityspark.outclick', function (event) {
const details = event.detail;
let destinationHost;

try {
const destination = new URL(details.link);
if (destination.protocol === 'https:' || destination.protocol === 'http:') {
destinationHost = destination.hostname;
}
} catch (error) {
console.info('Unable to parse CitySpark outclick destination', error);
}

gtag('event', 'cityspark_outclick', {
cityspark_event_name: details.name,
city_state: details.cityState || undefined,
event_category: details.categoryTags ? details.categoryTags.join(',') : undefined,
event_start: details.start || undefined,
event_venue: details.venue || undefined,
session_view_count: details.sessionViewCount,
link_domain: destinationHost,
link_type: details.type,
share_type: details.shareType || undefined
});
});
</script>

The browser event provides the full destination in details.link. The example sends only its HTTP(S) hostname to GA4 because share URLs, mailto: links, and other destinations can contain email addresses, message bodies, identifiers, or sensitive query parameters. If you also send a link_url parameter, sanitize it according to your analytics provider's privacy requirements first. Do not send personal information to GA4.

Register custom dimensions for parameters such as link_type and share_type in GA4 if you want to use them in reports. This example does not send a page_view for clicks.

Important Behavior

Event

Reporting use

cityspark.details

Record an event details view as a virtual page view.

cityspark.search

Record a user-initiated search route change as a virtual page view.

cityspark.outclick

Record a tracked details-page link activation as a separate interaction.

Listeners should read event.detail without modifying it. Register each listener once per page; do not register additional listeners every time an SPA route changes.

Prevent Duplicate Analytics

Because the Portal behaves as an SPA, your analytics platform may already automatically record route changes as page views. If you use cityspark.details and cityspark.search to send virtual page views, avoid recording an additional automatic page view for the same route change.

GA4 enhanced measurement or another site-wide click listener may also record outbound links. Decide whether to use that measurement, cityspark.outclick, or both with distinct reporting purposes so the same click is not counted twice in your totals. Do not turn outclicks into extra page views.

Summary

  • cityspark.details tracks event details views.

  • cityspark.search tracks user-initiated search route changes.

  • cityspark.outclick tracks event websites, ticket links, More Info links, share buttons, and event social-profile links on the details page.

  • All three events are dispatched on document; register listeners early and only once.

  • Use details/search for virtual page views and outclicks for interactions.

  • Avoid duplicate page-view and outbound-click reporting, and sanitize URLs before forwarding them to analytics providers.

Did this answer your question?