8000 Purchases: Add analytics to the contact support links on the cancel p… · elsewhencode/wp-calypso@f5d0b3b · GitHub
[go: up one dir, main page]

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

Commit f5d0b3b

Browse files
committed
Purchases: Add analytics to the contact support links on the cancel purchase page
1 parent 9a0ed03 commit f5d0b3b

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

client/me/purchases/cancel-purchase/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const CancelPurchase = React.createClass( {
6060
</h2>
6161

6262
<div className="cancel-purchase__info">
63-
<CancelPurchaseSupportBox />
63+
<CancelPurchaseSupportBox purchase={ purchase } />
6464

6565
<div className="cancel-purchase__content">
6666
<div className="cancel-purchase__section">

client/me/purchases/cancel-purchase/support-box.jsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,27 @@
33
*/
44
import React from 'react';
55

6+
/**
7+
* Internal Dependencies
8+
*/
9+
import analytics from 'analytics';
10+
611
const CancelPurchaseSupportBox = React.createClass( {
12+
propTypes: {
13+
purchase: React.PropTypes.object.isRequired,
14+
},
15+
16+
trackClickContactSupport() {
17+
if ( ! this.props.purchase ) {
18+
return;
19+
}
20+
21+
analytics.tracks.recordEvent(
22+
'calypso_purchases_click_contact_support',
23+
{ product_slug: this.props.purchase.productSlug }
24+
);
25+
},
26+
727
render() {
828
const contactSupportUrl = 'https://support.wordpress.com/';
929

@@ -20,14 +40,15 @@ const CancelPurchaseSupportBox = React.createClass( {
2040
'If you are unsure about canceling or have any questions about this purchase, please {{a}}contact support{{/a}}.',
2141
{
2242
components: {
23-
a: <a href={ contactSupportUrl } target="_blank" />
43+
a: <a href={ contactSupportUrl } target="_blank" onClick={ this.trackClickContactSupport } />
2444
}
2545
}
2646
) }
2747
</p>
2848

2949
<a href={ contactSupportUrl }
3050
target="_blank"
51+
onClick={ this.trackClickContactSupport }
3152
className="button is-primary">
3253
{ this.translate( 'Contact Support' ) }
3354
</a>

0 commit comments

Comments
 (0)
0