Skip to content

Commit

Permalink
Merge pull request #397 from google/feature/387-tracking-verification
Browse files Browse the repository at this point in the history
Custom dimensions for site verification and search console.
  • Loading branch information
felixarntz authored Aug 14, 2019
2 parents 4a59c0d + dc75212 commit 6842b00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions assets/js/components/setup/search-console.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { Select, TextField, Input } from 'SiteKitCore/material-components';
import PropTypes from 'prop-types';
import Button from 'SiteKitCore/components/button';
import HelpLink from 'GoogleComponents/help-link';
import { sendAnalyticsTrackingEvent } from 'GoogleUtil';

const { __, sprintf } = wp.i18n;
const { Component, Fragment } = wp.element;
Expand Down Expand Up @@ -128,6 +129,8 @@ class SearchConsole extends Component {
*/
async insertPropertyToSearchConsole( siteURL ) {
const response = await data.set( 'modules', 'search-console', 'insert', { siteURL } );
sendAnalyticsTrackingEvent( 'search_console_setup', 'add_new_sc_property' );

this.setState( {
loading: false,
connected: true,
Expand Down
10 changes: 9 additions & 1 deletion assets/js/components/setup/site-verification.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import Button from 'GoogleComponents/button';
import ProgressBar from 'GoogleComponents/progress-bar';
import { TextField, Input } from 'SiteKitCore/material-components';
import PropTypes from 'prop-types';
import { validateJSON } from 'GoogleUtil';
import {
validateJSON,
sendAnalyticsTrackingEvent,
} from 'GoogleUtil';
import HelpLink from 'GoogleComponents/help-link';

const { __ } = wp.i18n;
Expand Down Expand Up @@ -68,11 +71,15 @@ class SiteVerification extends Component {

// Our current siteURL has been verified. Proceed to next step.
if ( verified ) {
sendAnalyticsTrackingEvent( 'verification_setup', 'verification_check_true' );

const response = await this.insertSiteVerification( identifier );
if ( true === response.updated ) {
this.props.siteVerificationSetup( true );
return true;
}
} else {
sendAnalyticsTrackingEvent( 'verification_setup', 'verification_check_false' );
}

this.setState( {
Expand Down Expand Up @@ -125,6 +132,7 @@ class SiteVerification extends Component {
const response = await this.insertSiteVerification( siteURL );

if ( true === response.updated ) {
sendAnalyticsTrackingEvent( 'verification_setup', 'verification_insert_tag' );

// We have everything we need here. go to next step.
this.props.siteVerificationSetup( true );
Expand Down

0 comments on commit 6842b00

Please sign in to comment.