Add tracking on button click.
This commit is contained in:
parent
a289b1146d
commit
49e754b962
|
@ -6,6 +6,7 @@ import { createInterpolateElement, useState } from '@wordpress/element';
|
||||||
import { Button } from '@wordpress/components';
|
import { Button } from '@wordpress/components';
|
||||||
import { PLUGINS_STORE_NAME } from '@woocommerce/data';
|
import { PLUGINS_STORE_NAME } from '@woocommerce/data';
|
||||||
import { useDispatch } from '@wordpress/data';
|
import { useDispatch } from '@wordpress/data';
|
||||||
|
import { recordEvent } from '@woocommerce/tracks';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
|
@ -45,6 +46,11 @@ const GetStartedButton = () => {
|
||||||
isBusy={ isGettingStarted }
|
isBusy={ isGettingStarted }
|
||||||
isPrimary
|
isPrimary
|
||||||
onClick={ () => {
|
onClick={ () => {
|
||||||
|
setIsGettingStarted( true );
|
||||||
|
recordEvent(
|
||||||
|
'wccore_subscriptions_empty_state_get_started_click',
|
||||||
|
{}
|
||||||
|
);
|
||||||
installAndActivatePlugins( [ 'woocommerce-payments' ] )
|
installAndActivatePlugins( [ 'woocommerce-payments' ] )
|
||||||
.then( () => {
|
.then( () => {
|
||||||
// TODO: Handle success.
|
// TODO: Handle success.
|
||||||
|
@ -54,7 +60,6 @@ const GetStartedButton = () => {
|
||||||
// TODO: Handle erorr.
|
// TODO: Handle erorr.
|
||||||
console.log( 'Oh no, there was an error!' );
|
console.log( 'Oh no, there was an error!' );
|
||||||
} );
|
} );
|
||||||
setIsGettingStarted( true );
|
|
||||||
} }
|
} }
|
||||||
>
|
>
|
||||||
{ __( 'Get started', 'woocommerce-payments' ) }
|
{ __( 'Get started', 'woocommerce-payments' ) }
|
||||||
|
|
Loading…
Reference in New Issue