Sitecore XM Cloud and JSS
Using tail.js with headless Sitecore solutions is exactly the same as normal React and NextJS.
However, the package @tailjs/sitecore-jss contains an extended Tracker component called SitecoreTracker that should be used instead.