Google Ads là một 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 thông qua các chiến dịch quảng cáo trực tuyến. Trong đó, quảng cáo tìm kiếm thích ứng nổi bật với khả năng tối ưu hóa hiệu suất thông qua việc thay đổi tiêu đề và mô tả dựa trên nhu cầu người dùng. Trong bài viết này, chúng ta sẽ tìm hiểu cách tạo và chỉnh sửa quảng cáo tìm kiếm thích ứng một cách chi tiết để đảm bảo chiến dịch của bạn đạt hiệu quả tối ưu nhất.
Thêm quảng cáo tìm kiếm thích ứng
Cách tối ưu nhất để thiết lập một quảng cáo mới trong API Google Ads là sử dụng tính năng Thêm quảng cáo tìm kiếm thích ứng. Đây là loại quảng cáo được Google tối ưu tự động bằng cách thử nghiệm và kết hợp nhiều tiêu đề và mô tả khác nhau để tăng cường khả năng hiển thị. Để thực hiện, bạn có thể tham khảo mã mẫu có sẵn trong thư mục Hoạt động cơ bản của thư viện ứng dụng. Mẫu mã này giúp bạn xử lý toàn bộ quá trình xác thực ở chế độ nền và cung cấp hướng dẫn cụ thể để bạn tạo quảng cáo tìm kiếm thích ứng một cách hiệu quả.
Hiện tại, ví dụ về tính năng này chưa có sẵn cho ngôn ngữ lập trình Java. Tuy nhiên, các ngôn ngữ khác như C#, PHP, Python, Ruby, và Perl đều được hỗ trợ và bạn có thể tham khảo để thực hiện việc thêm quảng cáo tìm kiếm thích ứng một cách hiệu quả trong chiến dịch Google Ads của mình.
C#
// bản quyền 2021 google llc
//
// được cấp phép theo giấy phép apache, phiên bản 2.0 (giấy phép);
// bạn không thể sử dụng file này trừ khi tuân thủ giấy phép.
// bạn có thể lấy bản sao của giấy phép tại địa chỉ:
//
// http://www.apache.org/licenses/license-2.0
//
// trừ khi luật pháp yêu cầu hoặc đã được viết rõ ràng, phần mềm phân phối theo giấy phép này
// được cung cấp theo dạng "nguyên trạng", không có đảm bảo hoặc điều kiện gì dưới bất kỳ hình thức nào,
// dù là theo thỏa thuận hay các hình thức khác. tham khảo giấy phép để biết thêm chi tiết
// về các quyền và giới hạn.using commandline;using google.ads.gax.examples;
using google.ads.gax.util;
using google.ads.googleads.lib;
using google.ads.googleads.v17.common;
using google.ads.googleads.v17.resources;
using google.ads.googleads.v17.services;
using system.collections.generic;
using system.linq;
using system;
using static google.ads.googleads.v17.enums.adgrouptypeenum.types;
using static google.ads.googleads.v17.enums.adgroupadstatusenum.types;
using static google.ads.googleads.v17.enums.adgroupcriterionstatusenum.types;
using static google.ads.googleads.v17.enums.adgroupstatusenum.types;
using static google.ads.googleads.v17.enums.advertisingchanneltypeenum.types;
using static google.ads.googleads.v17.enums.budgetdeliverymethodenum.types;
using static google.ads.googleads.v17.enums.campaignstatusenum.types;
using static google.ads.googleads.v17.enums.customizerattributetypeenum.types;
using static google.ads.googleads.v17.enums.keywordmatchtypeenum.types;
using static google.ads.googleads.v17.services.suggestgeotargetconstantsrequest.types;
using google.ads.googleads.config;
using google.ads.googleads.extensions.config;
namespace google.ads.googleads.examples.v17
{
/// <summary>
/// thêm thuộc tính tùy chỉnh, liên kết thuộc tính này với khách hàng, sau đó thêm quảng cáo tìm kiếm thích ứng với mô tả sử dụng trình tùy chỉnh quảng cáo vào nhóm quảng cáo chỉ định.
/// </summary>
public class addresponsivesearchadfull : examplebase
{
/// <summary>
/// </summary>
public class options : optionsbase
{
/// <summary>
/// id khách hàng google ads.
/// </summary>
[option(“customerid”, required = true, helptext =
“id khách hàng google ads.”)]
public long customerid { get; set; }
/// <summary>
/// tên thuộc tính tùy chỉnh của google ads.
/// </summary>
[option(“customizerattributename”, required = false, helptext =
“tên thuộc tính tùy chỉnh của google ads.”, default = customizer_attribute_name)]
public string customizerattributename { get; set; }
}
/// <summary>
/// phương thức chính để chạy ví dụ này dưới dạng ứng dụng độc lập.
/// </summary>
/// <param name=”args”>các đối số dòng lệnh.</param>
public static void main(string[] args)
{
options options = exampleutilities.parsecommandline<options>(args);
addresponsivesearchadfull codeexample =
new addresponsivesearchadfull();
console.writeline(codeexample.description);
codeexample.run(
new googleadsclient(),
options.customerid,
options.customizerattributename
);
}
// tên của thuộc tính tùy chỉnh trong trình tùy chỉnh quảng cáo phải là duy nhất cho mỗi tài khoản khách hàng. để chạy ví dụ này nhiều lần, hãy thay đổi giá trị này hoặc chỉ định đối số tương ứng. lưu ý rằng có giới hạn cho số lượng thuộc tính tùy chỉnh được kích hoạt trong một tài khoản, vì vậy bạn không nên chạy ví dụ này quá thường xuyên.
//
// xem chi tiết tại liên kết sau:
// https://developers.google.com/google-ads/api/docs/ads/customize-responsive-search-ads#rules_and_limitations
private const string customizer_attribute_name = “price”;
/// <summary>
/// trả về mô tả về ví dụ mã.
/// </summary>
public override string description =>
“thêm thuộc tính tùy chỉnh, liên kết thuộc tính tùy chỉnh với khách hàng, và sau đó “ +
“thêm quảng cáo tìm kiếm thích ứng với mô tả sử dụng trình tùy chỉnh quảng cáo vào nhóm quảng cáo chỉ định.”;
/// <summary>
/// chạy ví dụ.
/// </summary>
/// <param name=”client”>khách hàng google ads.</param>
/// <param name=”customerid”>id khách hàng google ads.</param>
/// <param name=”customizerattributename”>tên thuộc tính tùy chỉnh.</param>
public void run(
googleadsclient client,
long customerid,
string customizerattributename)
{
string customizerattributeresourcename = createcustomizerattribute(
client,
customerid,
customizerattributename
);
linkcustomizerattributetocustomer(client, customerid, customizerattributeresourcename);
string campaignbudgetresourcename = addcampaignbudget(client, customerid);
string campaignresourcename = addcampaign(client, customerid,
campaignbudgetresourcename);
string adgroupresourcename = addadgroup(client, customerid, campaignresourcename);
createresponsivesearchadwithcustomization(
client,
customerid,
adgroupresourcename,
customizerattributename
);
addkeywords(client, customerid, adgroupresourcename);
addgeotargeting(client, customerid, campaignresourcename);
}
/// <summary>
/// tạo thuộc tính tùy chỉnh với tên thuộc tính tùy chỉnh chỉ định.
/// </summary>
/// <param name=”client”>khách hàng google ads api.</param>
/// <param name=”customerid”>id khách hàng.</param>
/// <param name=”customizerattributename”>tên thuộc tính tùy chỉnh.</param>
/// <returns>tên tài nguyên thuộc tính tùy chỉnh đã tạo.</returns>
private string createcustomizerattribute(
googleadsclient client,
long customerid,
string customizerattributename)
{
// tạo một thao tác thuộc tính tùy chỉnh để tạo thuộc tính tùy chỉnh.
customizerattributeoperation operation = new customizerattributeoperation() {
// tạo thuộc tính tùy chỉnh với tên chỉ định.
create = new customizerattribute() {
name = customizerattributename,
// chỉ định loại là ‘price’ để có thể tùy chỉnh động phần mô tả của quảng cáo là giá sản phẩm/dịch vụ.
type = customizerattributetype.price
}
};
customizerattributeserviceclient serviceclient =
client.getservice(services.v17.customizerattributeservice);
// gửi yêu cầu mutate để thêm thuộc tính tùy chỉnh và in thông tin của nó.
mutatecustomizerattributesresponse response =
serviceclient.mutatecustomizerattributes(
customerid.tostring(),
new [] { operation }.tolist()
);
string resourcename = response.results[0].resourcename;
console.writeline($”đã thêm thuộc tính tùy chỉnh với tên tài nguyên ‘{resourcename}‘.”);
return resourcename;
}
/// <summary>
/// liên kết thuộc tính tùy chỉnh với khách hàng bằng cách cung cấp giá trị sẽ được sử dụng trong quảng cáo tìm kiếm thích ứng sẽ được tạo ở bước sau.
/// </summary>
/// <param name=”client”>khách hàng google ads api.</param>
/// <param name=”customerid”>id khách hàng.</param>
/// <param name=”customizerattributeresourcename”>tên tài nguyên của thuộc tính tùy chỉnh.</param>
private void linkcustomizerattributetocustomer(
googleadsclient client,
long customerid,
string customizerattributeresourcename)
{
// tạo thao tác tùy chỉnh khách hàng.
customercustomizeroperation operation = new customercustomizeroperation() {
// tạo tùy chỉnh khách hàng với giá trị sẽ được sử dụng trong quảng cáo tìm kiếm thích ứng.
create = new customercustomizer() {
customizerattribute = customizerattributeresourcename,
value = new customizervalue() {
type = customizerattributetype.price,
// chỉ định ‘100usd’ dưới dạng giá trị văn bản. trình tùy chỉnh quảng cáo sẽ thay thế động trình giữ chỗ bằng giá trị này khi quảng cáo hiển thị.
stringvalue = “100usd”
}
}
};
customercustomizerserviceclient serviceclient =
client.getservice(services.v17.customercustomizerservice);
// gửi yêu cầu mutate để thêm tùy chỉnh khách hàng và in thông tin của nó.
mutatecustomercustomizersresponse response =
serviceclient.mutatecustomercustomizers(
customerid.tostring(),
new [] { operation }.tolist()
);
string resourcename = response.results[0].resourcename;
console.writeline($”đã thêm tùy chỉnh khách hàng với tên tài nguyên ‘{resourcename}‘.”);
}
/// <summary>
/// thêm ngân sách chiến dịch.
/// </summary>
/// <param name=”client”>khách hàng google ads.</param>
/// <param name=”customerid”>id khách hàng google ads cho cuộc gọi này.</param>
/// <returns>tên tài nguyên ngân sách chiến dịch.</returns>
private static string addcampaignbudget(googleadsclient client, long customerid)
{
// lấy dịch vụ ngân sách chiến dịch.
campaignbudgetserviceclient campaignbudgetservice =
client.getservice(services.v17.campaignbudgetservice);
// tạo ngân sách.
campaignbudget campaignbudget = new campaignbudget()
{
name = “interplanetary cruise budget #” + exampleutilities.getrandomstring(),
amountmicros = 3_000_000,
deliverymethod = budgetdeliverymethod.standard
};
// tạo thao tác.
campaignbudgetoperation operation = new campaignbudgetoperation()
{
create = campaignbudget
};
// thêm ngân sách chiến dịch.
mutatecampaignbudgetsresponse response =
campaignbudgetservice.mutatecampaignbudgets(customerid.tostring(),
new campaignbudgetoperation[] { operation });
// hiển thị kết quả.
string budgetresourcename = response.results[0].resourcename;
console.writeline($”đã thêm ngân sách với tên tài nguyên ‘{budgetresourcename}‘.”);
return budgetresourcename;
}
/// <summary>
/// thêm chiến dịch.
/// </summary>
/// <param name=”client”>khách hàng google ads.</param>
/// <param name=”customerid”>id khách hàng google ads cho cuộc gọi này.</param>
/// <param name=”budgetresourcename”>tên tài nguyên ngân sách chiến dịch.</param>
/// <returns>tên tài nguyên chiến dịch.</returns>
private static string addcampaign(googleadsclient client, long customerid,
string budgetresourcename)
{
// lấy dịch vụ chiến dịch.
campaignserviceclient campaignservice = client.getservice(services.v17.campaignservice);
// tạo chiến dịch.
campaign campaign = new campaign()
{
name = “testing rsa via api #” + exampleutilities.getrandomstring(),
advertisingchanneltype = advertisingchanneltype.search,
status = campaignstatus.paused,
manualcpc = new manualcpc(),
networksettings = new campaign.types.networksettings()
{
targetgooglesearch = true,
targetsearchnetwork = true,
targetpartnersearchnetwork = false,
// bật mở rộng hiển thị trên chiến dịch tìm kiếm. xem chi tiết tại:
// https://support.google.com/google-ads/answer/7193800
targetcontentnetwork = true
},
campaignbudget = budgetresourcename,
startdate = datetime.now.adddays(1).tostring(“yyyymmdd”),
enddate = datetime.now.adddays(30).tostring(“yyyymmdd”)
};
// tạo thao tác.
campaignoperation operation = new campaignoperation()
{
create = campaign
};
// thêm chiến dịch.
mutatecampaignsresponse response =
campaignservice.mutatecampaigns(customerid.tostring(),
new campaignoperation[] { operation });
// hiển thị kết quả.
string campaignresourcename = response.results[0].resourcename;
console.writeline($”đã thêm chiến dịch với tên tài nguyên ‘{campaignresourcename}‘.”);
return campaignresourcename;
}
/// <summary>thêm nhóm quảng cáo.</summary>
/// <param name=”client”>khách hàng google ads.</param>
/// <param name=”customerid”>id khách hàng google ads cho cuộc gọi này.</param>
/// <param name=”campaignresourcename”>tên tài nguyên chiến dịch.</param>
/// <returns>tên tài nguyên nhóm quảng cáo.</returns>
private static string addadgroup(googleadsclient client, long customerid,
string campaignresourcename)
{
// lấy dịch vụ nhóm quảng cáo.
adgroupserviceclient adgroupservice = client.getservice(services.v17.adgroupservice);
// tạo nhóm quảng cáo.
adgroup adgroup = new adgroup()
{
name = “testing rsa via api #” + exampleutilities.getrandomstring(),
campaign = campaignresourcename,
type = adgrouptype.searchstandard,
status = adgroupstatus.enabled,
// nếu bạn muốn thiết lập giá thầu tối đa cpc, hãy bỏ ghi chú dòng bên dưới.
// cpcbidmicros = 50_000
};
// tạo thao tác.
adgroupoperation operation = new adgroupoperation()
{
create = adgroup
};
// thêm nhóm quảng cáo.
mutateadgroupsresponse response =
adgroupservice.mutateadgroups(customerid.tostring(),
new adgroupoperation[] { operation });
// hiển thị kết quả.
string adgroupresourcename = response.results[0].resourcename;
console.writeline($”đã thêm nhóm quảng cáo với tên tài nguyên ‘{adgroupresourcename}‘.”);
return adgroupresourcename;
}
/// <summary>
/// tạo quảng cáo tìm kiếm thích ứng sử dụng thuộc tính tùy chỉnh chỉ định.
/// </summary>
/// <param name=”client”>khách hàng google ads api.</param>
/// <param name=”customerid”>id khách hàng.</param>
/// <param name=”adgroupresourcename”>tên tài nguyên nhóm quảng cáo.</param>
/// <param name=”customizerattributename”>tên thuộc tính tùy chỉnh.</param>
private void createresponsivesearchadwithcustomization(
googleadsclient client,
long customerid,
string adgroupresourcename,
string customizerattributename)
{
// tạo thao tác nhóm quảng cáo.
adgroupadoperation operation = new adgroupadoperation() {
// tạo nhóm quảng cáo để chứa quảng cáo.
create = new adgroupad() {
adgroup = adgroupresourcename,
status = adgroupadstatus.enabled,
// tạo quảng cáo và thiết lập thông tin quảng cáo tìm kiếm thích ứng.
ad = new ad() {
responsivesearchad = new responsivesearchadinfo() {
headlines =
{
// thiết lập vị trí cho luôn chọn tiêu đề này là headline_1.
// vị trí là tùy chọn; nếu không thiết lập, các tiêu đề và mô tả sẽ được xoay vòng và những tiêu đề, mô tả có hiệu suất tốt nhất sẽ được sử dụng thường xuyên hơn.
new adtextasset() { text = “cruise to mars” },
new adtextasset() { text = “best space cruise line” },
new adtextasset() { text = “experience the stars” }
},
descriptions =
{
new adtextasset() { text = “buy your tickets now” },
// tạo mô tả cụ thể này sử dụng trình tùy chỉnh quảng cáo. để biết thêm chi tiết về định dạng giữ chỗ, xem tại:
// https://developers.google.com/google-ads/api/docs/ads/customize-responsive-search-ads#ad_customizers_in_responsive_search_ads
//
// trình tùy chỉnh quảng cáo sẽ thay thế động trình giữ chỗ bằng giá trị đã tạo trước đó và liên kết với khách hàng thông qua customercustomizer.
new adtextasset()
{
text = $”just {{customizer.{customizerattributename}:10usd}}”
}
},
path1 = “all-inclusive”,
path2 = “deals”
},
finalurls = { “http://www.example.com” }
}
}
};
// gửi yêu cầu mutate để thêm nhóm quảng cáo và in thông tin của nó.
adgroupadserviceclient serviceclient = client.getservice(services.v17.adgroupadservice);
mutateadgroupadsresponse response = serviceclient.mutateadgroupads(
customerid.tostring(),
new [] { operation }.tolist()
);
string resourcename = response.results[0].resourcename;
console.writeline($”đã tạo quảng cáo tìm kiếm thích ứng với tên tài nguyên ‘{resourcename}‘.”);
}
/// <summary>
/// tạo 3 loại khớp từ khóa: exact, phrase và broad.
/// exact: quảng cáo có thể hiển thị trên các tìm kiếm có ý nghĩa giống với từ khóa của bạn.
/// phrase: quảng cáo có thể hiển thị trên các tìm kiếm có bao gồm ý nghĩa của từ khóa.
/// broad: quảng cáo có thể hiển thị trên các tìm kiếm có liên quan đến từ khóa.
/// đối với đấu thầu thông minh, broad là loại khớp được khuyến nghị.
/// </summary>
/// <param name=”client”>khách hàng google ads api.</param>
/// <param name=”customerid”>id khách hàng.</param>
/// <param name=”adgroupresourcename”>tên tài nguyên nhóm quảng cáo.</param>
private void addkeywords(googleadsclient client, long customerid,
string adgroupresourcename)
{
// lấy dịch vụ adgroupcriterionservice.
adgroupcriterionserviceclient adgroupcriterionservice =
client.getservice(services.v17.adgroupcriterionservice);
list<adgroupcriterionoperation> operations = new list<adgroupcriterionoperation>();
adgroupcriterionoperation exactmatchoperation = new adgroupcriterionoperation()
{
create = new adgroupcriterion()
{
adgroup = adgroupresourcename,
status = adgroupcriterionstatus.enabled,
keyword = new keywordinfo()
{
text = “example of exact match”,
matchtype = keywordmatchtype.exact
},
// bỏ ghi chú dòng dưới đây nếu bạn muốn thay đổi từ khóa này thành mục tiêu phủ định.
// negative = true
}
};
// trường lặp tùy chọn
// exactmatchoperation.create.finalurls.add(“https://www.example.com”);
operations.add(exactmatchoperation);
adgroupcriterionoperation phrasematchoperation = new adgroupcriterionoperation()
{
create = new adgroupcriterion()
{
adgroup = adgroupresourcename,
status = adgroupcriterionstatus.enabled,
keyword = new keywordinfo()
{
text = “example of phrase match”,
matchtype = keywordmatchtype.phrase
},
// bỏ ghi chú dòng dưới đây nếu bạn muốn thay đổi từ khóa này thành mục tiêu phủ định.
// negative = true
}
};
// trường lặp tùy chọn
// phrasematchoperation.create.finalurls.add(“https://www.example.com”);
operations.add(phrasematchoperation);
adgroupcriterionoperation broadmatchoperation = new adgroupcriterionoperation()
{
create = new adgroupcriterion()
{
adgroup = adgroupresourcename,
status = adgroupcriterionstatus.enabled,
keyword = new keywordinfo()
{
text = “example of broad match”,
matchtype = keywordmatchtype.broad
},
// bỏ ghi chú dòng dưới đây nếu bạn muốn thay đổi từ khóa này thành mục tiêu phủ định.
// negative = true
}
};
// trường lặp tùy chọn
// broadmatchoperation.create.finalurls.add(“https://www.example.com”);
operations.add(broadmatchoperation);
mutateadgroupcriteriaresponse response =
adgroupcriterionservice.mutateadgroupcriteria(customerid.tostring(), operations);
// hiển thị kết quả.
foreach (mutateadgroupcriterionresult newadgroupcriterion in response.results)
{
console.writeline(“đã tạo từ khóa với tên tài nguyên ‘{0}’.”,
newadgroupcriterion.resourcename);
}
}
/// <summary>
/// tạo nhắm mục tiêu theo vị trí địa lý.
/// </summary>
/// <param name=”client”>khách hàng google ads api.</param>
/// <param name=”customerid”>id khách hàng.</param>
/// <param name=”campaignresourcename”>tên tài nguyên chiến dịch.</param>
private void addgeotargeting(googleadsclient client, long customerid,
string campaignresourcename)
{
geotargetconstantserviceclient geotargetconstantservice =
client.getservice(services.v17.geotargetconstantservice);
suggestgeotargetconstantsrequest suggestgeotargetconstantsrequest =
new suggestgeotargetconstantsrequest()
{
// ngôn ngữ sử dụng định dạng iso 639-1.
locale = “es”,
// danh sách mã quốc gia có sẵn có thể tham khảo tại:
// https://developers.google.com/google-ads/api/reference/data/geotargets
countrycode = “ar”,
locationnames = new locationnames()
{
names = {“buenos aires”, “san isidro”, “mar del plata”}
}
};
suggestgeotargetconstantsresponse suggestgeotargetconstantsresponse =
geotargetconstantservice.suggestgeotargetconstants(
suggestgeotargetconstantsrequest);
list<campaigncriterionoperation> operations = new list<campaigncriterionoperation>();
foreach (geotargetconstantsuggestion suggestion in
suggestgeotargetconstantsresponse.geotargetconstantsuggestions)
{
console.writeline($”geo target constant: {suggestion.geotargetconstant.name} được “ +
$”tìm thấy trong ngôn ngữ địa phương ({suggestion.locale}) với phạm vi tiếp cận ({suggestion.reach}) từ “ +
$”thuật ngữ tìm kiếm ({suggestion.searchterm})”);
campaigncriterionoperation operation = new campaigncriterionoperation()
{
create = new campaigncriterion()
{
campaign = campaignresourcename,
location = new locationinfo()
{
geotargetconstant = suggestion.geotargetconstant.resourcename
}
}
};
operations.add(operation);
}
campaigncriterionserviceclient campaigncriterionservice =
client.getservice(services.v17.campaigncriterionservice);
mutatecampaigncriteriaresponse mutatecampaigncriteriaresponse =
campaigncriterionservice.mutatecampaigncriteria(customerid.tostring(), operations);
foreach (mutatecampaigncriterionresult result in mutatecampaigncriteriaresponse.results)
{
console.writeline($”đã thêm tiêu chí chiến dịch {result.resourcename}“);
}
}
}
}
Thay đổi quảng cáo tìm kiếm thích ứng
Như đã đề cập trước đây, chỉ một số loại quảng cáo nhất định mới có thể được thay đổi. Ví dụ dưới đây minh họa cách chỉnh sửa một quảng cáo tìm kiếm thích ứng hiện có.
private void runExample(GoogleAdsClient googleAdsClient, long customerId, long adId) {
// tạo một AdOperation để cập nhật quảng cáo.
AdOperation.Builder adOperation = AdOperation.newBuilder();// tạo một quảng cáo trong trường cập nhật của thao tác.Ad.Builder adBuilder =
adOperation
.getUpdateBuilder()
.setResourceName(ResourceNames.ad(customerId, adId))
.addFinalUrls(“http://www.example.com/”)
.addFinalMobileUrls(“http://www.example.com/mobile”);
// đặt các thuộc tính quảng cáo tìm kiếm thích ứng cần cập nhật.
adBuilder
.getResponsiveSearchAdBuilder()
.addAllHeadlines(
ImmutableList.of(
AdTextAsset.newBuilder()
.setText(“Cruise to Pluto #” + getShortPrintableDateTime())
.setPinnedField(ServedAssetFieldType.HEADLINE_1)
.build(),
AdTextAsset.newBuilder().setText(“Tickets on sale now”).build(),
AdTextAsset.newBuilder().setText(“Buy your ticket now”).build()))
.addAllDescriptions(
ImmutableList.of(
AdTextAsset.newBuilder().setText(“Best space cruise ever.”).build(),
AdTextAsset.newBuilder()
.setText(“The most wonderful space experience you will ever have.”)
.build()));
// đặt update mask (các trường sẽ được chỉnh sửa) là tất cả các trường đã thiết lập ở trên.
adOperation.setUpdateMask(FieldMasks.allSetFieldsOf(adBuilder.build()));
// tạo một dịch vụ khách hàng để kết nối với api.
try (AdServiceClient adServiceClient =
googleAdsClient.getLatestVersion().createAdServiceClient()) {
// gửi yêu cầu mutate.
MutateAdsResponse response =
adServiceClient.mutateAds(
String.valueOf(customerId), ImmutableList.of(adOperation.build()));
// hiển thị kết quả.
for (MutateAdResult result : response.getResultsList()) {
System.out.printf(“Quảng cáo với tên tài nguyên ‘%s’ đã được cập nhật.%n”, result.getResourceName());
}
}
}
Việc sử dụng quảng cáo tìm kiếm thích ứng trong Google Ads giúp tối ưu hóa chiến dịch quảng cáo bằng cách thử nghiệm nhiều phiên bản tiêu đề và mô tả khác nhau. Thông qua các hướng dẫn chi tiết và cách thay đổi quảng cáo trên, bạn sẽ có thể dễ dàng quản lý và tối ưu hóa quảng cáo để đạt được kết quả tốt nhất. Hãy tận dụng sức mạnh của quảng cáo tìm kiếm thích ứng để nâng cao hiệu suất chiến dịch Google Ads của bạn ngay hôm nay.
