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){ if(isset($awca_auth_settings_save['api_secret']) && !empty($awca_auth_settings_save['api_secret'])) { 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 Enter Measurement Protocol API secret key!
'; $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'])){ if(strpos((string)$awca_auth_settings_save['tracking_id'],'G') !== false){ if(isset($awca_auth_settings_save['api_secret']) && !empty($awca_auth_settings_save['api_secret'])){ update_option('awca_auth_settings',$awca_auth_settings_save); echo ""; $awca_auth_settings = $awca_auth_settings_save; }else{ $errors .= 'Please Enter Measurement Protocol API secret key!
'; $awca_auth_settings = $awca_auth_settings_save; } }else{ 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_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.

We not recommeneding this method. If possible please use auto connect method.

Please Enter your property-id to link with website and hit submit button.

Please put your Google Analytics Propety Id here.

Please start auto-linking process by clicking below button.

link Please link your Google Analyitcs Account for data collection.
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->webDataStreams)&&!empty($web_data_streams->webDataStreams)){ foreach ($web_data_streams->webDataStreams as $web_data_stream){ $optgroup = $property->displayName; if ( ! isset( $ga_properties[ $optgroup ] ) ) { $ga_properties[ $optgroup ] = []; } $ga_properties[ $optgroup ][ $property->property . '|G-' . $web_data_stream->measurementId ] = sprintf( '%s (G-%s)', $web_data_stream->displayName, $web_data_stream->measurementId ); natcasesort( $ga_properties[ $optgroup ] ); } } } } } }?> Choose Property for which you want to track data.

An API SECRET generated in the Google Analytics UI.
To create a new secret, navigate to: Admin/Property/Data Streams/choose your stream/Measurement Protocol/Create