@@ -152,23 +152,28 @@ jqueryReady(() => {
152152 console . debug (
153153 `eventValue=${ eventValue } , currentValue=${ currentValue } `
154154 ) ;
155- if ( currentValue !== '' && eventValue > 0 ) {
156- // Google Analytics event
157- const dataLayer = window . dataLayer || [ ] ;
158- dataLayer . push ( {
159- event : 'rateThisPage' ,
160- eventLabel : rating ,
161- eventValue : eventValue ,
162- eventFeedback : currentValue ,
155+ if ( eventValue > 0 ) {
156+ // Send feedback to Mattermost channel
157+ const feedbackData = {
158+ text : `**Page Feedback Received**\n\n**Page:** ${ window . location . href } \n**Rating:** ${ rating } \n**Feedback:** ${ currentValue || 'No additional feedback provided' } ` ,
159+ username : 'Documentation Feedback' ,
160+ icon_emoji : rating === 'Yes' ? ':smile:' : rating === 'Somewhat' ? ':neutral_face:' : ':frowning:'
161+ } ;
162+
163+ // TODO: Replace with your Mattermost webhook URL
164+ // TODO: Set webhook URL via environment variable or config
165+ const webhookUrl = process . env . MATTERMOST_FEEDBACK_WEBHOOK ||
166+ 'WEBHOOK_URL_NOT_SET' ;
167+
168+ fetch ( webhookUrl , {
169+ method : 'POST' ,
170+ headers : {
171+ 'Content-Type' : 'application/json' ,
172+ } ,
173+ body : JSON . stringify ( feedbackData ) ,
174+ } ) . catch ( error => {
175+ console . error ( 'Failed to send feedback to Mattermost:' , error ) ;
163176 } ) ;
164- // Rudderstack event
165- if ( typeof rudderanalytics !== 'undefined' ) {
166- rudderanalytics . track ( 'feedback_submitted' , {
167- label : rating ,
168- rating : eventValue ,
169- feedback : currentValue ,
170- } ) ;
171- }
172177 }
173178 jqueryParents (
174179 evt . target ,
0 commit comments