Logging page views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â04-18-2024 03:21 AM - edited â04-18-2024 03:22 AM
Hey team, I'm facing an issue regarding logging page views in the sp_log table when a user clicks on a link. Presently, it's only registering when the user directly clicks on it. If the user hovers over and selects "open in new tab," or uses the mouse wheel to open it, the action isn't being recorded in the sp_log table
HTML
<div class="mu-gbl-resources-item" ng-repeat="subtopics in data.childTopics" ng-click="c.captureClickCount(subtopics)">
<a ng-if="subtopics.name =='Policies'" ng-click="loadKBPolicies()">
{{subtopics.name}}
</a>
</div>
Client
ââc.captureClickCount = function(item) {
ââââc.data.contentItemID = item.id;
ââââc.data.contentName = item.name;
ââââc.data.action = "addClickCount";
ââââc.server.update().then(function(){
ââââââââââc.data.action = undefined;
ââââââââââc.data.message = "";
ââââââ})
ââ}
Server
if (input && input.action == "addClickCount")
ââ{
ââââdata.messages = input.messages;
ââââ$sp.logStat('Quick Link View','sn_ex_sp_quick_link',input.contentItemID,input.contentName,$sp.getPortalRecord().getUniqueValue());
ââ}
