Skip to content

Commit cd609b2

Browse files
committed
Add content filtering for in app messages
1 parent e7e58fd commit cd609b2

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

frontend/express/views/dashboard.html

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,29 @@ <h4><a href="#/analytics/events/key/{{encodeURIComponent this.name}}">{{this.nam
20052005
if (countlyGlobal.tracking.server_feedback) {
20062006
//display in app messages
20072007
if (Countly.content && Countly.content.enterContentZone) {
2008-
Countly.content.enterContentZone();
2008+
Countly.user_details({custom:{content_messages:true}}); // Ensure user is eligible for content messages
2009+
Countly.content.enterContentZone(function(params){
2010+
if (params.journeyId && (params.widget_id || params.id)) {
2011+
var check = params.journeyId + "_";
2012+
if (params.widget_id) {
2013+
check += "widget_" + params.widget_id;
2014+
}
2015+
else {
2016+
check += "content_" + params.id;
2017+
}
2018+
var key = "cly_seenJourneyIds_c2VlbkpvdXJuZXlJZHM"; // Base64 for 'seenJourneyIds' to avoid potential key conflicts
2019+
var seen = JSON.parse(localStorage.getItem(key) || "[]");
2020+
2021+
if (seen.includes(check)) {
2022+
return false;
2023+
}
2024+
2025+
seen.push(check);
2026+
localStorage.setItem(key, JSON.stringify(seen));
2027+
return true;
2028+
}
2029+
return false;
2030+
});
20092031
}
20102032
}
20112033
}

0 commit comments

Comments
 (0)