Tracking with Segment

Learn how to set up your Bucket tracking using Segment.io

In order to get started quickly with the full set of tracking and customer satisfaction collection in your app, we recommend always to use browser tracking. This can be done by enabling the Bucket Web (Actions) destination

Set up browser tracking (recommended)

Tracking in the browser through Segment Analytics.js can be done by using the Bucket Web (Actions) destination. It loads the Bucket Tracking SDK for you and automatically enables Live Satisfaction for immediate customer feedback.

  1. Set up Bucket Web (Actions) destination to receive data from a Segment website source

  2. Copy your Bucket App tracking key from the "Tracking" page and add it to the "Tracking Key" settings field in the destination

    Bucket tracking pageSegment destination settings
  3. If you are using strict Content Security Policies, follow the instructions about Content Security Policy setup

  4. Enable the destination

  5. Check your Bucket Tracking page for data to arrive. This can take a while because Segment caches your Analytics.js configuration. Check back in a while

🚧

Special case

If you are using both browser and server destinations from the same Segment source, you should also read Running both server and browser tracking

Set up server tracking

Tracking from your backend services can be done through Segment cloud destinations. For Bucket tracking, use Bucket Cloud Destination

  1. Set up Bucket Cloud destination to receive data from a Segment source

  2. Copy your Bucket App tracking key from the "Tracking" page and add it to the "API Key" settings field in the destination

    Bucket tracking pageSegment destination settings
  3. Enable the destination

  4. Check your Bucket Tracking page for data to arrive. Data should start flowing immediately

📘

Live Satisfaction

Note that Live Satisfaction will not be enabled when using a cloud destination, as browser scripting is required for gathering customer feedback in your app UI

Running both server and browser tracking

If you are running both server tracking and browser tracking to the same Bucket app from the same Segment source, you will get duplicate events tracked. To avoid this, disable the mapping of Track Event in the Bucket Web (Actions) destination so your mapping looks like this:

Tracking page views

Bucket doesn't support the Segment analytics.page()-call to track pages. If page views are important for you, you can convert page events to track events in the Bucket Web (Actions) destination like this:

  1. Go to the "Mappings" tab
  2. Press "New Mapping"
  3. Select the "Track Event" action
  4. In the "Select events to map and send" section, change the event type from event to page
  5. In the "Select mappings" section, change the Event Name mapping to send in the Segment events name field. Optionally prefix it with Page: or append with Viewed to be able to add a distinguishable pattern from your normal event names

Content Security Policies (CSP)

If you are running with strict Content Security Policies active on your website, you will need to enable these directives in order to use this destination:

DirectiveValuesModuleReason
script-src-elemhttps://cdn.jsdelivr.netbootstrapLoads the Bucket tracking SDK from a CDN
connect-srchttps://tracking.bucket.cotrackingUsed for all tracking methods: analytics.identify(), analytics.group() and analytics.track()
connect-srchttps://livemessaging.bucket.colive satisfactionServer sent events from the Bucket Live Feedback service, which allows for automatically collecting feedback when a user used a feature.
style-src'unsafe-inline'feedback UIThe feedback UI is styled with inline styles. Not having this directive results unstyled HTML elements.

As HTTP-header:

Content-Security-Policy: script-src-elem https://cdn.jsdelivr.net; connect-src https://livemessaging.bucket.co https://tracking.bucket.co; style-src 'unsafe-inline'

As <meta>-tag:

<meta http-equiv="Content-Security-Policy" content="script-src-elem https://cdn.jsdelivr.net; connect-src https://livemessaging.bucket.co https://tracking.bucket.co; style-src 'unsafe-inline'">

📘

Only in the browser

These Content Security Policy rules are only needed when using the browser-based destination Bucket Web (Actions), not when using the server-based destination Bucket Cloud.


What’s Next

When you see your data flowing in from your tracking, it's time to set up features: