Skip to content
Snippets Groups Projects
Commit 386dfd7c authored by Allen Gilliland's avatar Allen Gilliland
Browse files

add tracking to various aspects of the Pulse UI.

parent a1c7196e
Branches
Tags
No related merge requests found
......@@ -6,6 +6,7 @@ import PulseEditChannels from "./PulseEditChannels.jsx";
import WhatsAPulse from "./WhatsAPulse.jsx";
import ActionButton from "metabase/components/ActionButton.jsx";
import MetabaseAnalytics from "metabase/lib/analytics";
import ModalWithTrigger from "metabase/components/ModalWithTrigger.jsx";
import ModalContent from "metabase/components/ModalContent.jsx";
import DeleteModalWithConfirm from "metabase/components/DeleteModalWithConfirm.jsx";
......@@ -41,15 +42,23 @@ export default class PulseEdit extends Component {
this.props.dispatch(fetchCards());
this.props.dispatch(fetchUsers());
this.props.dispatch(fetchPulseFormInput());
MetabaseAnalytics.trackEvent((this.props.pulseId) ? "PulseEdit" : "PulseCreate", "Start");
}
async save() {
await this.props.dispatch(saveEditingPulse());
MetabaseAnalytics.trackEvent((this.props.pulseId) ? "PulseEdit" : "PulseCreate", "Complete", this.props.pulse.cards.length);
this.props.onChangeLocation("/pulse");
}
async delete() {
await this.props.dispatch(deletePulse(this.props.pulse.id));
MetabaseAnalytics.trackEvent("PulseDelete", "Complete");
this.props.onChangeLocation("/pulse");
}
......
......@@ -3,6 +3,9 @@ import React, { Component, PropTypes } from "react";
import CardPicker from "./CardPicker.jsx";
import PulseCardPreview from "./PulseCardPreview.jsx";
import MetabaseAnalytics from "metabase/lib/analytics";
export default class PulseEditCards extends Component {
constructor(props) {
super(props);
......@@ -18,6 +21,8 @@ export default class PulseEditCards extends Component {
...pulse,
cards: [...pulse.cards.slice(0, index), { id: cardId }, ...pulse.cards.slice(index + 1)]
});
MetabaseAnalytics.trackEvent((this.props.pulseId) ? "PulseEdit" : "PulseCreate", "AddCard", index);
}
removeCard(index) {
......@@ -26,6 +31,8 @@ export default class PulseEditCards extends Component {
...pulse,
cards: [...pulse.cards.slice(0, index), ...pulse.cards.slice(index + 1)]
});
MetabaseAnalytics.trackEvent((this.props.pulseId) ? "PulseEdit" : "PulseCreate", "RemoveCard", index);
}
render() {
......
import React, { Component, PropTypes } from "react";
import _ from "underscore";
import RecipientPicker from "./RecipientPicker.jsx";
import SchedulePicker from "./SchedulePicker.jsx";
import SetupMessage from "./SetupMessage.jsx";
......@@ -8,6 +10,9 @@ import Select from "metabase/components/Select.jsx";
import Toggle from "metabase/components/Toggle.jsx";
import Icon from "metabase/components/Icon.jsx";
import MetabaseAnalytics from "metabase/lib/analytics";
const CHANNEL_ICONS = {
email: "mail",
slack: "slack"
......@@ -51,6 +56,8 @@ export default class PulseEditChannels extends Component {
};
this.props.setPulse({ ...pulse, channels: pulse.channels.concat(channel) });
MetabaseAnalytics.trackEvent((this.props.pulseId) ? "PulseEdit" : "PulseCreate", "AddChannel", type);
}
removeChannel(index) {
......@@ -61,6 +68,11 @@ export default class PulseEditChannels extends Component {
onChannelPropertyChange(index, name, value) {
let { pulse } = this.props;
let channels = [...pulse.channels];
if (_.contains(['schedule_type', 'schedule_day', 'schedule_hour'], name)) {
MetabaseAnalytics.trackEvent((this.props.pulseId) ? "PulseEdit" : "PulseCreate", channels[index].channel_type+":"+name, value);
}
channels[index] = { ...channels[index], [name]: value };
this.props.setPulse({ ...pulse, channels });
}
......@@ -71,6 +83,8 @@ export default class PulseEditChannels extends Component {
} else {
let { pulse } = this.props;
this.props.setPulse({ ...pulse, channels: pulse.channels.filter((c) => c.channel_type !== type) });
MetabaseAnalytics.trackEvent((this.props.pulseId) ? "PulseEdit" : "PulseCreate", "RemoveChannel", type);
}
}
......@@ -103,6 +117,7 @@ export default class PulseEditChannels extends Component {
<div>
<div className="h4 text-bold mb1">To:</div>
<RecipientPicker
isNewPulse={this.props.pulseId === undefined}
recipients={channel.recipients}
recipientTypes={channelSpec.recipients}
users={this.props.userList}
......
......@@ -4,6 +4,8 @@ import Icon from "metabase/components/Icon.jsx";
import Popover from "metabase/components/Popover.jsx";
import UserAvatar from "metabase/components/UserAvatar.jsx";
import MetabaseAnalytics from "metabase/lib/analytics";
import _ from "underscore";
import cx from "classnames";
......@@ -128,10 +130,14 @@ export default class RecipientPicker extends Component {
// recipient is a user object, or plain object containing "email" key
this.props.onRecipientsChange(this.props.recipients.concat(recipient));
this.setInputValue("");
MetabaseAnalytics.trackEvent((this.props.isNewPulse) ? "PulseCreate" : "PulseEdit", "AddRecipient", (recipient.id) ? "user" : "email");
}
removeRecipient(recipient) {
this.props.onRecipientsChange(this.props.recipients.filter(r => recipient.id != null ? recipient.id !== r.id : recipient.email !== r.email));
MetabaseAnalytics.trackEvent((this.props.isNewPulse) ? "PulseCreate" : "PulseEdit", "RemoveRecipient", (recipient.id) ? "user" : "email");
}
render() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment