Skip to content

Commit

Permalink
Merge pull request #7162 from google/enhancement/6875-fix-ads-convers…
Browse files Browse the repository at this point in the history
…ion-input-condition
  • Loading branch information
aaemnnosttv authored Jun 14, 2023
2 parents 7d0fc4f + acb3cb8 commit 296fe3d
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ import { __ } from '@wordpress/i18n';
*/
import Data from 'googlesitekit-data';
import { TextField, HelperText, Input } from '../../../../material-components';
import { MODULES_ANALYTICS } from '../../datastore/constants';
import { CORE_FORMS } from '../../../../googlesitekit/datastore/forms/constants';
import { FORM_SETUP, MODULES_ANALYTICS } from '../../datastore/constants';
import { MODULES_ANALYTICS_4 } from '../../../analytics-4/datastore/constants';
import VisuallyHidden from '../../../../components/VisuallyHidden';
import { isValidAdsConversionID } from '../../util';
Expand All @@ -53,6 +54,9 @@ export default function AdsConversionIDTextField() {
const ga4SnippetEnabled = useSelect( ( select ) =>
select( MODULES_ANALYTICS_4 ).getUseSnippet()
);
const isUAEnabled = useSelect( ( select ) =>
select( CORE_FORMS ).getValue( FORM_SETUP, 'enableUA' )
);

const { setAdsConversionID } = useDispatch( MODULES_ANALYTICS );
const onChange = useCallback(
Expand All @@ -78,8 +82,9 @@ export default function AdsConversionIDTextField() {
// but only hide it if the value is valid otherwise the user will be blocked.
if (
isValidValue &&
! snippetEnabled &&
! ( ga4ReportingEnabled && ga4SnippetEnabled )
( ga4ReportingEnabled
? ! ( isUAEnabled && snippetEnabled ) && ! ga4SnippetEnabled
: ! snippetEnabled )
) {
return null;
}
Expand Down

0 comments on commit 296fe3d

Please sign in to comment.