Skip to content
This repository was archived by the owner on Mar 6, 2023. It is now read-only.

Commit 253c556

Browse files
committed
Fixed a bug where total events was not being reported to intercom
1 parent aea9182 commit 253c556

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/intercom/intercom-directive.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,18 @@
6767
// TODO: include the total event count for the organization.
6868
var currentOrganization = getCurrentOrganization();
6969
if (currentOrganization) {
70+
var total = 0;
71+
angular.forEach(currentOrganization.usage || [], function(data, key) {
72+
total += data.total || 0;
73+
});
74+
7075
data.company = {
7176
company_id: currentOrganization.id,
7277
name: currentOrganization.name,
7378
remote_created_at: objectIDService.create(currentOrganization.id).timestamp,
7479
plan: currentOrganization.plan_id,
75-
monthly_spend: currentOrganization.billing_price
80+
monthly_spend: currentOrganization.billing_price,
81+
total_events: total
7682
};
7783

7884
if (currentOrganization.subscribe_date) {

0 commit comments

Comments
 (0)