The SegmentStream SDK adds a first-party measurement layer alongside GA4. It preserves ad platform click IDs during internal navigation, sends cookieless pings to SegmentStream, and can send conversion events throughDocumentation Index
Fetch the complete documentation index at: https://docs.segmentstream.com/llms.txt
Use this file to discover all available pages before exploring further.
segmentstream.conversion().
What the SDK does
- Click ID propagation: preserves ad platform click IDs, such as
gclid,fbclid,ttclid,msclkid,li_fat_id,ScCid,rdt_cid,twclid,dclid, andepik, across internal links,window.open, and History API navigation. - Cookieless pings: sends page-load and first-interaction pings to SegmentStream without relying on analytics cookies.
- Conversion tracking: sends direct conversion events from the website through
segmentstream.conversion().
Installing the SDK via GTM
Add the SDK code
Enter the following code. Replace
ID PROVIDED BY MANAGER with the ID provided by your SegmentStream account manager.Configuring SDK settings
By default, the SegmentStream SDK enables click ID propagation and cookieless pings. Browser storage is disabled unless you explicitly enable it. Available settings:| Setting | Default | Description |
|---|---|---|
click_id_propagation | true | Preserves ad platform click IDs across internal links, window.open, and History API navigation. |
cookieless_pings | true | Sends page-load and first-interaction pings to SegmentStream without relying on analytics cookies. |
local_storage | false | Enables localStorage for attribution touchpoints and conversion deduplication state. |
Aggregated conversions measurement
The SegmentStream SDK supports conversion tracking through a strict object API. Use it when you need SegmentStream to receive a direct conversion signal from the website, such as a purchase, lead, signup, or subscription.Implementation through GTM
Create a new tag
In Google Tag Manager, go to Tags, click New, name the tag SegmentStream Conversion Tracking, and choose the Custom HTML tag type.
Add the conversion code
In the HTML block, insert the appropriate code for your conversion type:
- Purchase (with order ID)
- Lead (no order ID)
- Signup (with value)
Replace
ORDER_ID and ORDER_VALUE with the variables used in your GA4 conversion tag.
Configure tag sequencing
In Tag Sequencing, make sure the SegmentStream SDK tag fires before this tag.
Implementation via SDK
You can trigger a conversion directly using the SDK method:Sending lead data to your CRM
When sending lead data from your website to your CRM, pass the user identifier provided by the SegmentStream SDK instead of using the_ga cookie value:
- If the user has consented to cookies, this method returns the
_gacookie value. - If the user has not consented, it returns a generated anonymous ID (instead of
null).
- If your CRM currently receives the
_gacookie value, replace it withwindow.segmentstream.anonymousId(). - If replacement is not possible, send the
anonymousId()value to a separate field in your CRM. - On the same page where the lead is sent to the CRM, call
window.segmentstream.conversion({ type: 'lead' }).
Verifying the SDK
Confirm the SDK ping
After page load, open the browser Network tab and look for a POST request to
https://track.segmentstream.com/ds/PROJECT_ID with eventName: "ping".Confirm click ID propagation
Open a page with a test click ID, such as
?gclid=test, then click an internal link. The click ID should remain in the URL after navigation.Confirm conversion tracking
Trigger the conversion action and look for a POST request to
https://track.segmentstream.com/ds/PROJECT_ID with eventName: "conversion" and conversionEventName matching the type value you passed to segmentstream.conversion().

