為提供使用者安全可靠的廣告生態環境,並遵守相關規定 新興法規,Google 現在規定廣告客戶必須完成一或多項 驗證計畫。
如果必須完成驗證計畫,可能已設定期限 進行驗證如果在期限內未通過驗證 完成,您的帳戶可能就會暫停。
您也可以主動進行驗證,不一定要進行驗證。
IdentityVerificationService
提供執行下列操作的方法:
- 擷取客戶帳戶的驗證程序狀態。 包括任何期限
- 開始驗證程序
擷取驗證狀態
如要擷取
客戶帳戶,請呼叫 GetIdentityVerification
方法:
Java
This example is not yet available in Java; you can take a look at the other languages.
C#
private static IdentityVerification GetIdentityVerification( GoogleAdsClient client, long customerId) { IdentityVerificationServiceClient identityVerificationService = client.GetService(Services.V17.IdentityVerificationService); try { GetIdentityVerificationResponse response = identityVerificationService.GetIdentityVerification( new GetIdentityVerificationRequest() { CustomerId = customerId.ToString() } ); if (response.IdentityVerification.Count == 0) { return null; } IdentityVerification identityVerification = response.IdentityVerification[0]; string deadline = identityVerification.IdentityVerificationRequirement.VerificationCompletionDeadlineTime; IdentityVerificationProgress identityVerificationProgress = identityVerification.VerificationProgress; Console.WriteLine($"Account {customerId} has a verification completion " + $"deadline of {deadline} and status " + $"{identityVerificationProgress.ProgramStatus} for advertiser identity " + "verification."); return identityVerification; } catch (GoogleAdsException e) { Console.WriteLine("Failure:"); Console.WriteLine($"Message: {e.Message}"); Console.WriteLine($"Failure: {e.Failure}"); Console.WriteLine($"Request ID: {e.RequestId}"); throw; } }
PHP
This example is not yet available in PHP; you can take a look at the other languages.
Python
This example is not yet available in Python; you can take a look at the other languages.
小茹
def get_identity_verification(client, customer_id) response = client.service.identity_verification.get_identity_verification( customer_id: customer_id ) return nil if response.nil? || response.identity_verification.empty? identity_verification = response.identity_verification.first deadline = identity_verification. identity_verification_requirement. verification_completion_deadline_time progress = identity_verification.verification_progress puts "Account #{customer_id} has a verification completion deadline " \ "of #{deadline} and status #{progress.program_status} for advertiser " \ "identity verification." identity_verification end
Perl
sub get_identity_verification { my ($api_client, $customer_id) = @_; my $response = $api_client->IdentityVerificationService()->get({ customerId => $customer_id }); if (!defined $response->{identityVerification}) { printf "Account %s does not require advertiser identity verification.", $customer_id; return; } my $identity_verification = $response->{identityVerification}[0]; my $deadline = $identity_verification->{identityVerificationRequirement} {verificationCompletionDeadlineTime}; my $identity_verification_progress = $identity_verification->{verificationProgress}; printf "Account %s has a verification completion deadline of %s and status " . "%s for advertiser identity verification.", $customer_id, $deadline, $identity_verification_progress->{programStatus}; return $identity_verification; }
客戶帳戶已註冊必要的廣告主身分
驗證程式時,服務會傳回含有
IdentityVerification
物件清單。一個
空白回應表示客戶不需要進行客戶帳戶
廣告主身分驗證。
自第 16 版起,Google Ads API 僅支援 ADVERTISER_IDENTITY_VERIFICATION
所以這是清單中唯一的項目。
IdentityVerification
物件包含下列屬性:
說明
IdentityVerificationRequirement
的 開始並完成驗證程序用於說明應用程式目前狀態的
IdentityVerificationProgress
驗證程序:您也可以加入使用者的動作網址 完成驗證程序。
開始驗證程序
客戶帳戶已註冊必要的廣告主身分
驗證計畫 - GetIdentityVerification
傳回非空白
並附上驗證程序完成期限的回應,
呼叫 StartIdentityVerification
來進行驗證工作階段:
Java
This example is not yet available in Java; you can take a look at the other languages.
C#
private static void StartIdentityVerification(GoogleAdsClient client, long customerId) { IdentityVerificationServiceClient identityVerificationService = client.GetService(Services.V17.IdentityVerificationService); StartIdentityVerificationRequest request = new StartIdentityVerificationRequest() { CustomerId = customerId.ToString(), VerificationProgram = IdentityVerificationProgram.AdvertiserIdentityVerification }; try { identityVerificationService.StartIdentityVerification(request); } catch (GoogleAdsException e) { Console.WriteLine("Failure:"); Console.WriteLine($"Message: {e.Message}"); Console.WriteLine($"Failure: {e.Failure}"); Console.WriteLine($"Request ID: {e.RequestId}"); throw; } }
PHP
This example is not yet available in PHP; you can take a look at the other languages.
Python
This example is not yet available in Python; you can take a look at the other languages.
小茹
def start_identity_verification(client, customer_id) client.service.identity_verification.start_identity_verification( customer_id: customer_id, verification_program: :ADVERTISER_IDENTITY_VERIFICATION, ) end
Perl
sub start_identity_verification { my ($api_client, $customer_id) = @_; my $request = Google::Ads::GoogleAds::V17::Services::IdentityVerificationService::StartIdentityVerificationRequest ->new({ customerId => $customer_id, verificationProgram => ADVERTISER_IDENTITY_VERIFICATION }); $api_client->AdvertiserIdentityVerificationService() ->start_identity_verification($request); }
只有在沒有正在進行的驗證工作階段時,系統才會成功;
一旦您開始驗證工作階段,後續的呼叫
GetIdentityVerification
會傳回使用者完成的動作網址
驗證程序和動作網址的到期時間。
到期時間過後,您可以呼叫 StartIdentityVerification
以啟動新的驗證工作階段。