parse_awca_auth_settings($_POST['awca_auth_settings']); if (isset($awca_auth_settings_save['agreement'])) { if(!empty($awca_auth_settings_save['property_id'])|| !empty($awca_auth_settings_save['tracking_id'])) { if(isset($awca_auth_settings_save['property_id'])){ if(strpos((string)$awca_auth_settings_save['property_id'],'G') !== false){ unset($awca_auth_settings_save['tracking_id']); unset($awca_auth_settings_save['manual_tracking']); update_option('awca_auth_settings',$awca_auth_settings_save); echo ""; $awca_auth_settings = $awca_auth_settings_save; }else{ if($awca_auth_settings_save){ unset($awca_auth_settings_save['tracking_id']); unset($awca_auth_settings_save['manual_tracking']); update_option('awca_auth_settings',$awca_auth_settings_save); echo ""; $awca_auth_settings = $awca_auth_settings_save; }else { $errors .= 'Please complete Google Analytics Website Linking Process!
'; $awca_auth_settings = $awca_auth_settings_save; } } }else{ $manual_tracking = true; if(isset($awca_auth_settings_save['manual_tracking'])){ update_option('awca_auth_settings',$awca_auth_settings_save); echo ""; $awca_auth_settings = $awca_auth_settings_save; }else{ $errors .= 'Please confirm using manual tracking or use auto connect facility.
'; if(get_option('awca_auth_settings')){ delete_option('awca_auth_settings'); $awca_auth_settings = $awca_auth_settings_save; } $awca_auth_settings = $awca_auth_settings_save; } } }else { $errors .= 'Please complete Google Analytics Website Linking Process!
'; if(get_option('awca_auth_settings')){ delete_option('awca_auth_settings'); $awca_auth_settings = $awca_auth_settings_save; header("Refresh:0"); } $awca_auth_settings = $awca_auth_settings_save; } }else { $errors .= 'Please agree with privacy policy and terms of service of plugin!
'; $awca_auth_settings = $awca_auth_settings_save; } } else{ if((($awca_auth_settings['tracking_id']??false) || ($awca_auth_settings['manual_tracking']??false)) && empty($awca_auth_settings['property_id'])){ $manual_tracking = true; } if(!empty($analytics_ga4_properties)){ $manual_tracking = false; } } /* display error messages */ if (strlen($errors)> 0){ echo ""; } /* creating Authentication forms */ ?>
Authentication
Authentication
is_not_paying() && !(awca_fs()->is_trial())) { ?> Upgrade to Pro! bookDocumentation

Please choose your property which you want to link with website and hit submit button.

Please start auto-linking process by clicking below button.

Google sign-in Please link your Google Analyitcs Account for data collection.

Please Enter your property-id / Data stream measurement id to link with website and hit submit button.

'.$awca_auth_settings['tracking_id'].'';?>
Please put your Google Analytics Propety Id / Data stream measurement id from your GA4 here.
kind, $account_summary->id, $account_summary->name, $account_summary->webProperties ) ) { continue; } if ( 'analytics#accountSummary' !== $account_summary->kind ) { continue; } foreach ( $account_summary->webProperties as $property ) { if ( ! isset( $property->kind, $property->id, $property->name ) ) { continue; } if ( 'analytics#webPropertySummary' !== $property->kind ) { continue; } $optgroup = $account_summary->name; if ( ! isset( $ga_properties[ $optgroup ] ) ) { $ga_properties[ $optgroup ] = []; } $ga_properties[ $optgroup ][ $account_summary->id . '|' . $property->id ] = sprintf( '%s (%s)', $property->name, $property->id ); natcasesort( $ga_properties[ $optgroup ] ); } } }*/ if(isset($analytics_g4_properties) && !empty($analytics_g4_properties)&& is_array($analytics_g4_properties)){ foreach ( $analytics_g4_properties as $account_summary ) { if(isset($account_summary->propertySummaries)){ foreach ( $account_summary->propertySummaries as $property ) { $api = AWCA_Auth::get_instance()->get_google_management_api(); $web_data_streams = $api->get_web_data_streams($property->property); if(isset($web_data_streams->dataStreams)&&!empty($web_data_streams->dataStreams)){ foreach ($web_data_streams->dataStreams as $web_data_stream){ $optgroup = $property->displayName; if ( ! isset( $ga_properties[ $optgroup ] ) ) { $ga_properties[ $optgroup ] = []; } if(isset($web_data_stream->webStreamData->measurementId) && !empty($web_data_stream->webStreamData->measurementId)) $ga_properties[ $optgroup ][ $property->property . '|' . $web_data_stream->webStreamData->measurementId ] = sprintf( '%s (%s)', $web_data_stream->displayName, $web_data_stream->webStreamData->measurementId ); natcasesort( $ga_properties[ $optgroup ] ); } } } } } }?> Choose Property for which you want to track data.