satellite/analytics: Add analytics for "link shared" in objects view (#4130)

This commit is contained in:
prerna-parashar 2021-06-01 14:44:37 -07:00 committed by GitHub
parent 53322bb0a7
commit 75bf2ad586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 2 deletions

View File

@ -20,6 +20,7 @@ const (
eventPassphraseCreated = "Passphrase Created"
eventExternalLinkClicked = "External Link Clicked"
eventPathSelected = "Path Selected"
eventLinkShared = "Link Shared"
)
// Config is a configuration struct for analytics Service.
@ -51,7 +52,7 @@ func NewService(log *zap.Logger, config Config, satelliteName string) *Service {
if config.Enabled {
service.segment = segment.New(config.SegmentWriteKey)
}
for _, name := range []string{eventGatewayCredentialsCreated, eventPassphraseCreated, eventExternalLinkClicked, eventPathSelected} {
for _, name := range []string{eventGatewayCredentialsCreated, eventPassphraseCreated, eventExternalLinkClicked, eventPathSelected, eventLinkShared} {
service.clientEvents[name] = true
}
return service

View File

@ -19,6 +19,9 @@ import { ACCESS_GRANTS_ACTIONS } from '@/store/modules/accessGrants';
import { AccessGrant, GatewayCredentials } from '@/types/accessGrants';
import { MetaUtils } from '@/utils/meta';
import { AnalyticsEvent } from '@/utils/constants/analyticsEventNames';
import { AnalyticsHttpApi } from '@/api/analytics';
@Component({
components: {
FileBrowser,
@ -27,6 +30,7 @@ import { MetaUtils } from '@/utils/meta';
export default class UploadFile extends Vue {
private linksharingURL = '';
private worker: Worker;
private readonly analytics: AnalyticsHttpApi = new AnalyticsHttpApi();
/**
* Lifecycle hook after initial render.
@ -101,6 +105,8 @@ export default class UploadFile extends Vue {
path = encodeURIComponent(path.trim());
await this.analytics.eventTriggered(AnalyticsEvent.LINK_SHARED);
return `${this.linksharingURL}/${key}/${path}`;
} catch (error) {
await this.$notify.error(error.message);

View File

@ -7,4 +7,5 @@ export enum AnalyticsEvent {
PASSPHRASE_CREATED = 'Passphrase Created',
EXTERNAL_LINK_CLICKED = 'External Link Clicked',
PATH_SELECTED = 'Path Selected',
LINK_SHARED = 'Link Shared',
}