We have a script on the page for a 3rd party analytics system and want to send the contact ID to it. Will that be available on page load of the first request that xDB identifies the contact? Does that happen on the server-side on first request? Assume the contact information is already stored and the click is coming in with a different identifier that only xDB understands.
The contact is identified in the startTracking pipeline.
The startTracking pipeline contains multiple processor like below.
<startTracking> <processor type="Sitecore.Analytics.Pipelines.StartTracking.RaiseStartTracking, Sitecore.Analytics" /> <processor type="Sitecore.Analytics.Pipelines.StartTracking.InitializeTracker, Sitecore.Analytics" /> <processor type="Sitecore.Analytics.Pipelines.StartTracking.TrackerInitialized, Sitecore.Analytics" /> <processor type="Sitecore.Analytics.Pipelines.StartTracking.UpdateGeoIpData, Sitecore.Analytics" /> <processor type="Sitecore.Analytics.Pipelines.StartTracking.ProcessQueryStringCampaign, Sitecore.Analytics" /> <processor type="Sitecore.Analytics.Pipelines.StartTracking.ProcessQueryStringPageEvent, Sitecore.Analytics" /> <processor type="Sitecore.Analytics.Pipelines.StartTracking.ProcessQueryStringTriggers, Sitecore.Analytics"> <triggers hint="raw:AddTrigger"> <trigger querystring="sc_rss" eventname="RSS" /> </triggers> </processor> <processor type="Sitecore.Analytics.Pipelines.StartTracking.ProcessItem, Sitecore.Analytics" /> <processor type="Sitecore.Analytics.Pipelines.StartTracking.ExecuteMarketingRules, Sitecore.Analytics" marketingDefinitionsAssignment:require="!TrackingFieldOnly" resolve="true"/> </startTracking>
My sugestion is to inject here your own processor and to send data to the 3rd party system.
If you need more information about identify contacts have a look here: https://doc.sitecore.com/en/developers/90/sitecore-experience-platform/identifying-contacts.html
Every contact that has visited your website has an anonymous tracker identifier.
The tracker identifier matches Sitecore.Analytics.Tracker.Current.Contact.ContactId property, and is different from the contact’s ID in xConnect.
To have contact's ID from xConnect you need to identify the contact, and then the contact it will be saved to xConnect along with a new known identifier.
This identifier you will need probably.