Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gh 1775/feature/promo modal metrics pings #466

Merged
merged 4 commits into from Oct 28, 2019
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Next

Add promo modal metrics pings as per GH-1775

  • Loading branch information
wlycdgr committed Oct 28, 2019
commit 51a9333b791d2e58c78504da9b15d5cfde531536
@@ -64,10 +64,12 @@ class HomeViewContainer extends Component {
// TODO send appropriate metrics ping
_handlePromoSelectBasicClick = () => {
// GH-1777
// we want to show the Plus Promo modal once per Hub visit - not every time the user returns to the Home view
// we want to show the Plus Promo modal once per Hub visit
this.props.actions.markPlusPromoModalShown();

sendMessage('SET_PLUS_PROMO_MODAL_SEEN', {});

sendMessage('ping', 'promo_modals_select_basic_hub');
}

/**
@@ -77,10 +79,12 @@ class HomeViewContainer extends Component {
// TODO send appropriate metrics ping
_handlePromoSelectPlusClick = () => {
// GH-1777
// we want to show the Plus Promo modal once per Hub visit - not every time the user returns to the Home view
// we want to show the Plus Promo modal once per Hub visit
this.props.actions.markPlusPromoModalShown();

sendMessage('SET_PLUS_PROMO_MODAL_SEEN', {});

sendMessage('ping', 'promo_modals_select_plus_hub');
}

_render() {
@@ -103,10 +107,15 @@ class HomeViewContainer extends Component {
isPlus,
};

const showPromoModal = !isPlus && !plus_promo_modal_shown;
if (showPromoModal) {
sendMessage('ping', 'promo_modals_show_plus_choice_hub');
}

return (
<div className="full-height">
<PlusPromoModal
show={!isPlus && !plus_promo_modal_shown}
show={showPromoModal}
location="hub"
handleSelectBasicClick={this._handlePromoSelectBasicClick}
handleSelectPlusClick={this._handlePromoSelectPlusClick}
@@ -198,9 +198,15 @@ class Panel extends React.Component {
}

_handlePromoNoThanksClick = (modal) => {
// TODO metrics ping
this.props.actions.togglePromoModal();

sendMessage('promoModals.turnOffPromos', {});

if (modal === 'insights') {
sendMessage('ping', 'promo_modals_decline_insights_upgrade');
} else if (modal === 'plus_upgrade') {
sendMessage('ping', 'promo_modals_decline_plus_upgrade');
}
};

_handlePromoSignInClick = (modal) => {
@@ -211,24 +217,36 @@ class Panel extends React.Component {
});
};

_handlePromoSelectBasicClick = () => {
// TODO send metrics ping
_handlePromoSelectBasicClick = (location) => {
this.props.actions.togglePromoModal();

sendMessage('ping', 'promo_modals_select_basic_panel');
};

_handlePromoSelectPlusClick = () => {
// TODO send metrics ping
_handlePromoSelectPlusClick = (location) => {
This conversation was marked as resolved by christophertino

This comment has been minimized.

@christophertino

christophertino Oct 28, 2019
Member

Does ESLint throw an unused arg error here?

This comment has been minimized.

@wlycdgr

wlycdgr Oct 28, 2019
Author Member

Thought I needed this, realized I didn't, but forgot to remove. Removing. Also removed unused modal arg from _handlePromoSignInClick

this.props.actions.togglePromoModal();

sendMessage('ping', 'promo_modals_select_plus_panel');
};

_handlePromoSubscribeClick = (modal) => {
// TODO send metrics ping
this.props.actions.togglePromoModal();

if (modal === 'insights') {
sendMessage('ping', 'promo_modals_insights_upgrade_cta');
} else if (modal === 'plus_upgrade') {
sendMessage('ping', 'promo_modals_plus_upgrade_cta');
}
};

_handlePromoXClick = (modal) => {
// TODO send metrics ping
this.props.actions.togglePromoModal();

if (modal === 'insights') {
sendMessage('ping', 'promo_modals_decline_insights_upgrade');
} else if (modal === 'plus_upgrade') {
sendMessage('ping', 'promo_modals_decline_plus_upgrade');
}
};

_plusSubscriber = () => {
@@ -249,6 +267,7 @@ class Panel extends React.Component {
sendMessage('promoModals.sawPlusPromo', {});

if (this.props.promoModal === 'plus_upgrade') {
sendMessage('ping', 'promo_modals_show_upgrade_plus');
return (
<PlusUpgradePromoModal
handleNoThanksClick={this._handlePromoNoThanksClick}
@@ -260,6 +279,7 @@ class Panel extends React.Component {
}

// promoModal === 'plus_initial'
sendMessage('ping', 'promo_modals_show_plus_choice_panel');
return (
<PlusPromoModal
show
@@ -275,6 +295,8 @@ class Panel extends React.Component {

sendMessage('promoModals.sawInsightsPromo', '', 'metrics');
This conversation was marked as resolved by christophertino

This comment has been minimized.

@christophertino

christophertino Oct 28, 2019
Member

what does the 'metrics' argument do here? looks like the other message calls use the format sendMessage('promoModals.sawPlusPromo', {});

This comment has been minimized.

@wlycdgr

wlycdgr Oct 28, 2019
Author Member

Forgot to ask Ben to change this when we did the Insights promo modal PR. Removing.


sendMessage('ping', 'promo_modals_show_insights');

return (
<InsightsPromoModal
handleNoThanksClick={this._handlePromoNoThanksClick}
@@ -20,8 +20,18 @@ import Modal from '../Modal/Modal';

const DOMAIN = globals.DEBUG ? 'ghosterystage' : 'ghostery';

function _renderInitialVersion(props) {
const { show, location, clickHandler } = props;
/**
* A functional React component for a Plus Promo Modal that may be displayed in the Hub and/or Panel
* @return {JSX} JSX for rendering a Plus Promo Modal
* @memberof SharedComponents
*/
const PlusPromoModal = (props) => {
const {
show,
location,
handleSelectBasicClick,
handleSelectPlusClick
} = props;

const isInHub = location === 'hub';

@@ -55,7 +65,6 @@ function _renderInitialVersion(props) {
locationClassName
);

// TODO refactor for clarity & concision alongside implementing _renderUpgradeVersion for GH-1813
return (
<Modal show={show}>
<div className={contentClassNames}>
@@ -85,7 +94,7 @@ function _renderInitialVersion(props) {
<div className="PlusPromoModal__option-description-item">{t('fast_browsing')}</div>
</div>
</div>
<div className="PlusPromoModal__button basic" onClick={props.handleSelectBasicClick}>
<div className="PlusPromoModal__button basic" onClick={handleSelectBasicClick}>
<span>{t('select_basic')}</span>
</div>
</div>
@@ -118,22 +127,15 @@ function _renderInitialVersion(props) {
</div>
</div>
</div>
<a href={`https://checkout.${DOMAIN}.com/plus`} target="_blank" rel="noopener noreferrer" className="PlusPromoModal__button plus" onClick={props.handleSelectPlusClick}>
<a href={`https://checkout.${DOMAIN}.com/plus`} target="_blank" rel="noopener noreferrer" className="PlusPromoModal__button plus" onClick={handleSelectPlusClick}>
<span>{t('select_plus')}</span>
</a>
</div>
</div>
</div>
</Modal>
);
}

/**
* A Functional React component for a Plus Promo Modal
* @return {JSX} JSX for rendering a Plus Promo Modal
* @memberof SharedComponents
*/
const PlusPromoModal = props => _renderInitialVersion(props);
};

// PropTypes ensure we pass required props of the correct type
PlusPromoModal.propTypes = {
ProTip! Use n and p to navigate between commits in a pull request.