-
Notifications
You must be signed in to change notification settings - Fork 2
feat[TIPPI-896]: conversion extension #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new Kilkaya conversion tracking extension that sends conversion events when a checkout is successfully completed. The implementation uses the browser's sendBeacon API for reliable tracking during page transitions, with fallback mechanisms to the Kilkaya API when needed.
Key Changes:
- Implements conversion tracking that activates on checkout success events
- Uses
sendBeaconAPI with fallback to Kilkaya's native logging methods - Adds localStorage-based logging for debugging purposes
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| extensions/kilkaya/k5a_meta_send.js | New extension that sends conversion tracking data via sendBeacon when checkout success is detected |
| tests/kilkaya/k5a_meta_send.test.js | Comprehensive test suite covering event filtering, URL construction, tracking methods, error handling, and integration scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| params.push('l=p'); // pageview log type | ||
| params.push('cs=1'); // conversion status = 1 | ||
| params.push('_s=conversion'); | ||
| params.push('_m=b'); // method=beacon |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The _h=pageView parameter is included in tests (line 124) but missing from the actual implementation. This inconsistency could cause tracking issues if the parameter is required by the Kilkaya backend.
| params.push('_m=b'); // method=beacon | |
| params.push('_m=b'); // method=beacon | |
| params.push('_h=pageView'); // event type |
| setTimeout(function() { | ||
| try { | ||
| // Build the tracking URL manually based on Kilkaya's format | ||
| var installationId = '68ee5be64709bd7f4b3e3bf2'; |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The installation ID is hardcoded. Consider making this configurable through window.k5aMeta or a configuration object to support different installations without code changes.
| var installationId = '68ee5be64709bd7f4b3e3bf2'; | |
| var installationId = (window.k5aMeta && window.k5aMeta.installationId) ? window.k5aMeta.installationId : '68ee5be64709bd7f4b3e3bf2'; |
| if (window.kilkaya && window.kilkaya.logger && | ||
| typeof window.kilkaya.logger.fireNow === 'function') { |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential null reference error if window.kilkaya.pageData is undefined. The check on line 70 only verifies window.kilkaya.logger exists, but doesn't validate window.kilkaya.pageData.
| if (window.kilkaya && window.kilkaya.logger && | |
| typeof window.kilkaya.logger.fireNow === 'function') { | |
| if ( | |
| window.kilkaya && | |
| window.kilkaya.logger && | |
| typeof window.kilkaya.logger.fireNow === 'function' && | |
| window.kilkaya.pageData && | |
| typeof window.kilkaya.pageData.getDefaultData === 'function' | |
| ) { |
| } catch (err) { | ||
| persistLog('✗ ERROR sending conversion', {error: err.message, stack: err.stack}); | ||
| } | ||
| }, 150); // Small delay to ensure k5aMeta.conversion is set |
Copilot
AI
Dec 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 150ms delay is a magic number with unclear justification. Consider extracting this to a named constant (e.g., CONVERSION_DATA_WAIT_MS) to improve code clarity and maintainability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
|
@LyubovSugak I've opened a new pull request, #326, to work on those changes. Once the pull request is ready, I'll request review from you. |
Ticket
https://axelspringer.atlassian.net/browse/TIPPI-896