Google Ads là một trong những công cụ quảng cáo mạnh mẽ, giúp doanh nghiệp tiếp cận khách hàng tiềm năng một cách hiệu quả. Tuy nhiên, trong quá trình triển khai, các nhà quảng cáo có thể gặp phải lỗi vi phạm chính sách, ảnh hưởng đến việc hiển thị quảng cáo. Đừng lo lắng, bài viết này sẽ hướng dẫn bạn cách xử lý các lỗi vi phạm chính sách trên Google Ads một cách hiệu quả, từ việc phân tích nguyên nhân đến cách yêu cầu miễn trừ chính sách.
Khi bạn muốn gửi yêu cầu miễn trừ để xem xét lại các từ khóa hoặc quảng cáo vi phạm chính sách, bạn có thể sử dụng tính năng này trong các trường hợp sau:
- Quảng cáo: Nội dung chứa dấu câu hoặc cách trình bày không thông thường nhưng tuân thủ các tiêu chuẩn ngành.
- Từ khóa: Một số thuật ngữ y tế hoặc cụm từ nhạy cảm được sử dụng đúng mục đích, phù hợp với chính sách Google Ads và cần xem xét thêm.
Khi gửi yêu cầu thay đổi, như tạo mới hoặc cập nhật các đối tượng vi phạm chính sách, API sẽ trả về phản hồi dưới dạng GoogleAdsError cùng thông tin chi tiết trong lớp ErrorDetails.
Thông tin chi tiết về lỗi được chia theo loại đối tượng như sau:
| Loại đối tượng | Thông tin lỗi | Mã lỗi GoogleAdsError.error_code |
|---|---|---|
| Quảng cáo | policy_finding_details (PolicyFindingDetails) |
PolicyFindingError |
| Từ khóa | policy_violation_details (PolicyViolationDetails) |
PolicyViolationError |
Dựa trên loại lỗi và đối tượng liên quan, quy trình gửi yêu cầu miễn trừ sẽ khác nhau:
- Quảng cáo:
- Kiểm tra thông tin trong
policy_finding_details. - Xác định lý do vi phạm và chuẩn bị lý do biện minh dựa trên tiêu chuẩn ngành.
- Kiểm tra thông tin trong
- Từ khóa:
- Xem chi tiết trong
policy_violation_details. - Cung cấp bằng chứng chứng minh việc sử dụng từ khóa đúng chính sách.
- Xem chi tiết trong
Ví dụ về mã
Ví dụ về cách xử lý lỗi vi phạm chính sách:
- Xử lý lỗi vi phạm chính sách quảng cáo
- Xử lý lỗi vi phạm chính sách về từ khoá
Xử lý lỗi vi phạm chính sách quảng cáo
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.package com.google.ads.googleads.examples.errorhandling;
import com.google.ads.googleads.v18.common.AdTextAsset;
import com.google.ads.googleads.v18.common.PolicyTopicEntry;
import com.google.ads.googleads.v18.errors.PolicyFindingDetails;
import com.google.ads.googleads.v18.resources.AdGroupAd;
import com.google.ads.googleads.v18.services.AdGroupAdOperation;
import com.google.ads.googleads.v18.services.AdGroupAdServiceClient;
import com.google.ads.googleads.v18.services.MutateAdGroupAdsResponse;
import com.google.ads.googleads.lib.GoogleAdsClient;
import java.util.ArrayList;
import java.util.List;
/**
* Ví dụ minh họa cách yêu cầu miễn trừ lỗi vi phạm chính sách đối với quảng cáo tìm kiếm phản hồi.
*/
public class HandleResponsiveSearchAdPolicyViolations {
public static void main(String[] args) {
// Tạo đối tượng GoogleAdsClient.
GoogleAdsClient googleAdsClient = GoogleAdsClient.newBuilder().fromPropertiesFile().build();
// Gọi hàm xử lý lỗi vi phạm chính sách.
try {
new HandleResponsiveSearchAdPolicyViolations().runExample(googleAdsClient, 123456789L, 987654321L);
} catch (Exception e) {
System.err.println(“Lỗi khi xử lý yêu cầu: “ + e.getMessage());
}
}
/**
* Chạy ví dụ xử lý quảng cáo.
*/
public void runExample(GoogleAdsClient googleAdsClient, long customerId, long adGroupId) {
// Tạo quảng cáo nhóm với các nội dung thử nghiệm.
AdGroupAd.Builder adGroupAdBuilder = AdGroupAd.newBuilder()
.setAdGroup(ResourceNames.adGroup(customerId, adGroupId))
.setStatus(AdGroupAdStatus.PAUSED)
.getAdBuilder()
.addFinalUrls(“https://www.example.com”)
.getResponsiveSearchAdBuilder()
.addAllHeadlines(ImmutableList.of(
AdTextAsset.newBuilder().setText(“Cruise to Mars”).build(),
AdTextAsset.newBuilder().setText(“Best Space Cruise Line”).build(),
AdTextAsset.newBuilder().setText(“Experience the Stars”).build()))
.addAllDescriptions(ImmutableList.of(
AdTextAsset.newBuilder().setText(“Buy your tickets now!!!!!!!”).build(),
AdTextAsset.newBuilder().setText(“Visit the Red Planet”).build()));
AdGroupAdOperation operation = AdGroupAdOperation.newBuilder()
.setCreate(adGroupAdBuilder.build())
.build();
// Xử lý vi phạm chính sách.
try (AdGroupAdServiceClient client = googleAdsClient.getLatestVersion().createAdGroupAdServiceClient()) {
client.mutateAdGroupAds(String.valueOf(customerId), ImmutableList.of(operation));
} catch (GoogleAdsException ex) {
List<String> ignorableTopics = fetchIgnorablePolicyTopics(ex);
requestExemption(ignorableTopics, client, operation, customerId);
}
}
/**
* Tìm các chủ đề chính sách có thể được miễn trừ.
*/
private List<String> fetchIgnorablePolicyTopics(GoogleAdsException gae) {
List<String> ignorableTopics = new ArrayList<>();
for (GoogleAdsError error : gae.getGoogleAdsFailure().getErrorsList()) {
if (error.getDetails() != null && error.getDetails().hasPolicyFindingDetails()) {
for (PolicyTopicEntry topic : error.getDetails().getPolicyFindingDetails().getPolicyTopicEntriesList()) {
ignorableTopics.add(topic.getTopic());
}
}
}
return ignorableTopics;
}
/**
* Gửi yêu cầu miễn trừ các vi phạm chính sách.
*/
private void requestExemption(List<String> ignorableTopics, AdGroupAdServiceClient client, AdGroupAdOperation operation, long customerId) {
operation.toBuilder().getPolicyValidationParameterBuilder().addAllIgnorablePolicyTopics(ignorableTopics);
MutateAdGroupAdsResponse response = client.mutateAdGroupAds(String.valueOf(customerId), ImmutableList.of(operation));
System.out.printf(“Đã thêm quảng cáo thành công với tên tài nguyên ‘%s’.%n”, response.getResults(0).getResourceName());
}
}
Xử lý lỗi vi phạm chính sách về từ khoá
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.package com.google.ads.googleads.examples.errorhandling;
import com.google.ads.googleads.lib.GoogleAdsClient;
import com.google.ads.googleads.v18.common.KeywordInfo;
import com.google.ads.googleads.v18.errors.PolicyViolationKey;
import com.google.ads.googleads.v18.resources.AdGroupCriterion;
import com.google.ads.googleads.v18.services.AdGroupCriterionOperation;
import com.google.ads.googleads.v18.services.AdGroupCriterionServiceClient;
import com.google.ads.googleads.v18.services.MutateAdGroupCriteriaResponse;
import com.google.ads.googleads.v18.utils.ResourceNames;
import java.util.ArrayList;
import java.util.List;
/**
* Ví dụ này minh họa cách yêu cầu miễn trừ lỗi vi phạm chính sách từ khóa.
*/
public class HandleKeywordPolicyViolations {
public static void main(String[] args) {
GoogleAdsClient googleAdsClient = GoogleAdsClient.newBuilder().fromPropertiesFile().build();
long customerId = 123456789L; // Thay bằng ID khách hàng của bạn
long adGroupId = 987654321L; // Thay bằng ID nhóm quảng cáo của bạn
String keywordText = “medication”; // Thay bằng từ khóa của bạn
try {
new HandleKeywordPolicyViolations()
.runExample(googleAdsClient, customerId, adGroupId, keywordText);
} catch (Exception e) {
System.err.println(“Lỗi xử lý: “ + e.getMessage());
}
}
/**
* Chạy ví dụ xử lý từ khóa.
*/
public void runExample(
GoogleAdsClient googleAdsClient, long customerId, long adGroupId, String keywordText) {
try (AdGroupCriterionServiceClient client =
googleAdsClient.getLatestVersion().createAdGroupCriterionServiceClient()) {
// Cấu hình thông tin từ khóa
KeywordInfo keywordInfo =
KeywordInfo.newBuilder().setText(keywordText).setMatchType(KeywordMatchType.EXACT).build();
// Tạo đối tượng AdGroupCriterion cho từ khóa
AdGroupCriterion adGroupCriterion =
AdGroupCriterion.newBuilder()
.setAdGroup(ResourceNames.adGroup(customerId, adGroupId))
.setKeyword(keywordInfo)
.build();
// Tạo thao tác thêm từ khóa
AdGroupCriterionOperation operation =
AdGroupCriterionOperation.newBuilder().setCreate(adGroupCriterion).build();
// Gửi yêu cầu đến API
try {
MutateAdGroupCriteriaResponse response =
client.mutateAdGroupCriteria(
String.valueOf(customerId), List.of(operation));
System.out.printf(
“Từ khóa được thêm thành công với tên tài nguyên ‘%s’.%n”,
response.getResults(0).getResourceName());
} catch (Exception e) {
List<PolicyViolationKey> exemptibleKeys = extractExemptiblePolicyViolationKeys(e);
if (!exemptibleKeys.isEmpty()) {
System.out.println(“Yêu cầu miễn trừ vi phạm chính sách…”);
operation =
operation.toBuilder()
.addAllExemptPolicyViolationKeys(exemptibleKeys)
.build();
MutateAdGroupCriteriaResponse response =
client.mutateAdGroupCriteria(
String.valueOf(customerId), List.of(operation));
System.out.printf(
“Thành công thêm từ khóa với miễn trừ vi phạm: ‘%s’.%n”,
response.getResults(0).getResourceName());
} else {
System.out.println(“Không thể gửi yêu cầu miễn trừ.”);
}
}
}
}
/**
* Trích xuất các khóa vi phạm chính sách có thể miễn trừ.
*/
private List<PolicyViolationKey> extractExemptiblePolicyViolationKeys(Exception e) {
List<PolicyViolationKey> exemptibleKeys = new ArrayList<>();
// Xử lý logic trích xuất thông tin từ lỗi vi phạm chính sách
// Thêm logic xử lý lỗi phù hợp
return exemptibleKeys;
}
}
Việc xử lý lỗi vi phạm chính sách trong Google Ads đòi hỏi sự cẩn thận và hiểu biết rõ về các quy định của nền tảng. Bằng cách áp dụng đúng quy trình và yêu cầu miễn trừ khi cần thiết, bạn có thể đảm bảo chiến dịch quảng cáo hoạt động hiệu quả, mang lại giá trị tối ưu cho doanh nghiệp. Hãy luôn tuân thủ chính sách của Google Ads để duy trì độ tin cậy và hiệu quả cho chiến dịch của bạn.
