Before you continue, implement the SegmentStream SDK snippet on your website.
When sending lead data from your website to your CRM, you should also send the user identifier provided by the SegmentStream SDK.
Instead of using the
_ga cookie value, pass the value returned by the following method:javascriptwindow.segmentstream.anonymousId()
- If the user has consented to cookies, this method will return the
_gacookie value.
- If the user has not consented, it will return a generated anonymous ID (instead of
null).
This approach ensures that SegmentStream’s aggregated attribution works for both consented and non-consented users.
How to implement:
- Replace the
_gacookie
If your CRM currently receives the
_ga cookie value, replace it with window.segmentstream.anonymousId().- If replacement is not possible
Send the
anonymousId() value to a separate field in your CRM.- Trigger the Conversion Event on the Same Page
On the same page where the lead is sent to the CRM, you must also call
window.segmentstream.conversion().Calling the conversion method on a different page, for example, a redirect page after the lead is sent, will not work for aggregated conversion attribution. The call must happen on the same page where the lead is submitted.
- Usage Example
javascript// code that sends data to the CRM const clientId = window.segmentstream.anonymousId(); sendLeadToCRM({ name: leadName, email: leadEmail, clientId: clientId }); // code that sends data to SegmentStream window.segmentstream.conversion();
This ensures consistent attribution coverage while remaining compliant with privacy regulations.