logo
By following this guide, you can implement basic event tracking for SegmentStream if you haven't set up Google Analytics 4 tracking on your website or prefer not to.
If you already have Google Tag Manager (GTM) implemented on your website, the steps to implement basic event tracking are straightforward.

SegmentStream admin panel setup

  1. Inside the admin panel navigate to Settings > Events Tracking.
  1. Copy the tracking URL found under the View setup instructions link and click SAVE.
Image without caption

Configure Streaming in your GTM

By following these steps, you will automatically send events for user interactions on your site. These interactions include page views, page scrolls, form interactions, outbound clicks, site searches, video engagements, and file downloads.
  1. Go to the Tags section in your Google Tag Manager container.
  1. Create a new Google Tag.
  1. Name it SegmentStream Configuration.
  1. Set the Tag ID to G-YK9K31DPYL.
  1. In the Configuration settings, add a server_container_url parameter and paste your SegmentStream project's Server Container URL into the value field.
  1. Set the send_page_view parameter and set its value to true.
  1. Set the trigger to All Pages.
  1. Click Save.
Image without caption

Add click event tracking

By tracking all click events, SegmentStream will gain a better understanding of how users interact with your website. This includes clicks on buttons, links, images, videos, forms, and other elements.
  1. Go to the Tags section in your Google Tag Manager container.
  1. Create a new Google Analytics: GA4 Event tag.
  1. Name it SegmentStream Streaming - click.
  1. Enter the Measurement ID G-YK9K31DPYL.
  1. Set the Event Name to click.
  1. In the Event Parameters settings, add the element_class and element_text parameters, with the values {{Click Classes}} and {{Click Text}} respectively.
  1. Set the trigger to Click - All Elements.
  1. Click Save.
Image without caption

Add purchase event tracking (required for ecommerce websites)

If you are implementing tracking on an ecommerce website, it is required to implement tracking for your purchase events.

Pass data to the data layer

When a purchase is completed on your website, the purchase information should be passed to the data layer, which is the object used by Google Tag Manager to pass information to tags.
SegmentStream requires the following parameters to be passed with the purchase information:
Parameter name
Type
Example value
Description
transaction_id
string
T_12345
The unique identifier of a transaction.
value
number
25.42
The monetary value of the event.
currency
string
USD
Currency of the items associated with the event, in 3-letter ISO 4217 format.
The following is an example of a data layer purchase event:
javascript
dataLayer.push({ ecommerce: null }); dataLayer.push({ event: "purchase", ecommerce: { transaction_id: "T_12345", value: 25.42, currency: "USD" } });

Track purchase events in GTM

  1. Go to the Tags section in your Google Tag Manager container.
  1. Create a new Google Analytics: GA4 Event tag.
  1. Name it SegmentStream Streaming - purchase.
  1. Enter the Measurement ID G-YK9K31DPYL.
  1. Set the Event Name to purchase.
  1. Go to More Settings → Ecommerce, check the Send Ecommerce data option.
  1. Create a new Custom Event trigger with the Event name purchase.
    1. Image without caption
  1. Click Save.
    1. Image without caption

Test and publish your GTM container

  1. Use the GTM Preview functionality to test if the setup is correct before publishing the changes.
    1. Image without caption
  1. If the Preview container is successfully connected to your website you should see a notification.
    1. Image without caption
  1. Next, click through a couple of pages on your website to make sure events are being sent to SegmentStream.
  1. Then, open your Google Analytics settings page in the SegmentStream admin panel.
    1. Image without caption
  1. If the message is highlighted in red, try clicking on the refresh button.
  1. If the message persists, it means that data hasn't been collected yet. You should make sure you followed the guide correctly or contact our support team.
  1. If you see a message highlighted with green, informing you that data has been collected, you can Publish the GTM container.