On intercom there is a category of users called "slipping away" which includes users that haven't been online for 1-2 months. We noticed that some of the users in there definitely have been online during the past month & verified that this is indeed the case by asking them.
Then, after further testing, we noticed that for some of our staff (myself included) our own page views were not being registered properly. Some of the page views were being registered here and there but most weren't.
In the following I'll add the code for the integration of intercom with our react app & we would appreciate it if you had a look at it. If this is not the correct place to ask for tech support, please let me know.
This is the code for the integration itself:
import Analytics from "analytics";
import amplitudePlugin from "@analytics/amplitude";
import intercomPlugin from "@analytics/intercom";
import segmentPlugin from "@analytics/segment";
/* Initialize analytics */
export const analytics = Analytics({
app: "ba-web-client",
plugins: s
...(Boolean(process.env.NEXT_PUBLIC_SEGMENT_KEY)
?
segmentPlugin({
writeKey: process.env.NEXT_PUBLIC_SEGMENT_KEY,
}),
]
: ]),
amplitudePlugin({
apiKey:
process.env.NEXT_PUBLIC_AMPLITUDE_KEY ||
"HIDDEN",
options: {
trackingOptions: {
ip_address: false,
},
},
}),
intercomPlugin({
appId: "HIDDEN",
}),
],
});
This is the code for a hook that we have created, which we call on most pages (with the name of the page):
import { useEffect } from "react";
import { datadogRum } from "@datadog/browser-rum";
import { analytics } from "../../analytics";
export const usePageTrack = (title: string, props?: any) => {
useEffect(() => {
const event = `Viewed Web ${title}`;
analytics.page({ title });
analytics.track(event, props);
datadogRum.addAction(event, props);
}, ]);
};
I tried adding a callback to the analytics.page and analytics.track functions (with a simple console.log in it) and the callback did come back without any error, which does seem to imply that the integration is working well. Also, for some users the tracking does seem to work, but not for others, so it really doesn't seem to be a simple integration-issue.
We have also tested out different browsers, but weren't able to identify a pattern there either.
We would appreciate your help, thanks :)