Skip to content

Commit

Permalink
Merge pull request #30 from ibrahemomari/master
Browse files Browse the repository at this point in the history
add topic (viewed & sheared) analytics
  • Loading branch information
nteske authored Sep 1, 2022
2 parents d860630 + d5037fe commit 4b7a459
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions control/content/js/classes/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ class Analytics {
TOPIC_CRETAED: 'TOPIC_CRETAED',
TOPIC_REPORTED: 'TOPIC_REPORTED',
TOPIC_DELETED: 'TOPIC_DELETED',
TOPIC_VIEWED:"TOPIC_VIEWED",
TOPIC_SHEARED:"TOPIC_SHEARED",
}
}

static init() {
this.registerEvent('Topic Created', this.events.TOPIC_CRETAED, 'Occurs when a user create a new topic', false);
this.registerEvent('Topic Reported', this.events.TOPIC_REPORTED, 'Occurs when a user report about a topic', false);
this.registerEvent('Topic Deleted', this.events.TOPIC_DELETED, 'Occurs when a user delete a topic', false);
this.registerEvent('Topic Viewed', this.events.TOPIC_VIEWED, 'Occurs when a user view a topic', false);
this.registerEvent('Topic Shared', this.events.TOPIC_SHEARED, 'Occurs when a user share a topic', false);
}

static registerEvent(title, key, description, silentNotification) {
Expand Down
2 changes: 2 additions & 0 deletions widget/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ function createListLink(topic) {
if (event.target.tagName === 'BUTTON') {
return;
}
Helper.trackAction(Helper.EVENTS.TOPIC_VIEWED);
navigateTo(topic)
};

Expand Down Expand Up @@ -970,6 +971,7 @@ function shareWithOthers(data) {
console.log(err)
else
console.log(result)
Helper.trackAction(Helper.EVENTS.TOPIC_SHEARED);
});
}
});
Expand Down
2 changes: 2 additions & 0 deletions widget/js/classes/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class Helper {
TOPIC_CRETAED: 'TOPIC_CRETAED',
TOPIC_REPORTED: 'TOPIC_REPORTED',
TOPIC_DELETED: 'TOPIC_DELETED',
TOPIC_VIEWED: 'TOPIC_VIEWED',
TOPIC_SHEARED:"TOPIC_SHEARED",
}
}

Expand Down

0 comments on commit 4b7a459

Please sign in to comment.