Analytics Libraries Blocked by LWS
Analytics libraries require access to the entire page unrestricted. This requirement conflicts with the LWS requirement that code belonging to one namespace isn’t allowed to access data from a different namespace.
Experience Cloud sites can use a workaround to enable analytics libraries to work with Lightning Locker. This approach can also work if LWS is enabled in the org instead of Lightning Locker. The workaround applies only to Experience Cloud sites because Experience Builder gives admins access to the
head markup of the sites. Other Salesforce applications and components don’t allow such access. For more information, see the Experience Cloud Developer Guide.