This section covers common issues and solutions for analytics and tracking on SAP Commerce Cloud.
Common Issue Categories
Performance Issues
- LCP (Largest Contentful Paint) - Slow page load issues
- CLS (Cumulative Layout Shift) - Layout stability problems
Tracking Issues
- Events Not Firing - Missing or incomplete tracking
SAP Commerce Specific Considerations
Spartacus vs Accelerator
Different storefront types have different debugging approaches:
| Issue | Spartacus | Accelerator |
|---|---|---|
| Script loading | Angular module system | JSP include order |
| Event handling | RxJS Observables | jQuery events |
| SSR issues | Angular Universal | N/A (server-rendered) |
| Data layer | TypeScript service | JSP tag libraries |
Server-Side Rendering (SSR)
Spartacus with Angular Universal requires special handling:
// Check platform before browser APIs
import { isPlatformBrowser } from '@angular/common';
if (isPlatformBrowser(this.platformId)) {
// Safe to use window, document, etc.
window.dataLayer.push(data);
}
HAC Debugging
Use Hybris Administration Console for backend debugging:
- Logging - Configure log levels for analytics extensions
- Scripting - Run Groovy scripts for data inspection
- Monitoring - Check system performance metrics
Quick Diagnostic Checklist
Spartacus
- Check browser console for Angular errors
- Verify GTM/GA modules are imported
- Check Network tab for script loading
- Verify SSR hydration completed
- Test with Angular DevTools
Accelerator
- Check JSP include order in templates
- Verify tag libraries are loaded
- Check server logs for JSP errors
- Validate data layer in console
- Test with GTM Preview
Common Error Patterns
| Error | Platform | Solution |
|---|---|---|
window is not defined |
Spartacus SSR | Use isPlatformBrowser check |
dataLayer is undefined |
Both | Initialize dataLayer before GTM |
| Tags not firing | Both | Check trigger conditions in GTM |
| Duplicate events | Spartacus | Check subscription unsubscribe |
Support Resources
- SAP Commerce Cloud Documentation
- Spartacus Documentation
- Global Issues Hub - Platform-agnostic troubleshooting