-
Notifications
You must be signed in to change notification settings - Fork 480
Description
Description
Remove analytics attribute handling from Contentlet.tsx in sdk-react to reuse UVE (Universal Visual Editor) analytics attributes. Currently, the component has conditional logic that only renders analytics attributes when isAnalyticsActive && !isDevMode.
This task involves:
- Remove the
useIsAnalyticsActivehook - No longer needed since analytics will always be active - Remove conditional logic from
analyticsAttributesuseMemo - Analytics attributes should always be applied - Simplify the component - Analytics attributes from UVE will always be rendered, not conditionally
Key Change: Analytics attributes (provided by getDotAnalyticsAttributes from UVE) will always render, regardless of Edit Mode or analytics enabled state. This ensures consistent analytics tracking and removes unnecessary complexity.
Acceptance Criteria
- Remove
useIsAnalyticsActivehook import and usage - Remove conditional check
isAnalyticsActive && !isDevModefromanalyticsAttributesuseMemo - Remove conditional check
isAnalyticsActive && !isDevModefromcontainerClassNameuseMemo - Analytics attributes are always rendered (no conditional logic)
- Analytics class
dotcms-contentletis always applied - No regression in UVE functionality
- Unit tests updated and passing
Priority
Medium - This is a refactoring task to improve code maintainability and ensure consistent analytics behavior.
Additional Context
Technology: Front-end (React/TypeScript SDK)
Files affected:
core-web/libs/sdk/react/src/lib/next/components/Contentlet/Contentlet.tsx
Current behavior: Analytics attributes only render when isAnalyticsActive && !isDevMode
New behavior: Analytics attributes always render (reusing UVE's getDotAnalyticsAttributes)
Related work: This aligns with the overall strategy to consolidate analytics functionality and reduce code duplication across the SDK and UVE.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status