From 38eb7f858aab502ea541c162f7f8d97c189614e6 Mon Sep 17 00:00:00 2001 From: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:18:02 -0500 Subject: [PATCH] Split comments into parts (#3082) Signed-off-by: Fanit Kolchina --- assets/js/listener.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/assets/js/listener.js b/assets/js/listener.js index a0f28829..aba3a16a 100644 --- a/assets/js/listener.js +++ b/assets/js/listener.js @@ -59,9 +59,18 @@ function sendFeedback() { if (helpful === 'none' && comment === 'none') return; + // split the comment into 100-char parts because of GA limitation on custom dimensions + const commentLines = ["", "", "", ""]; + for (let i = 0; i <= (comment.length - 1)/100; i++) { + commentLines[i] = comment.substring(i * 100, Math.min((i + 1)*100, comment.length)); + } + gtag('event', 'feedback_click', { 'helpful': helpful, - 'comment': comment + 'comment': commentLines[0], + 'comment_2': commentLines[1], + 'comment_3': commentLines[2], + 'comment_4': commentLines[3], }); // show the hidden feedback text