כדי לתעד המרות, צריך להפעיל מעקב המרות בחשבון ההמרות ב-Google Ads. במדריך הזה מוסבר איך לוודא שמעקב ההמרות מופעל, איך להפעיל אותו אם הוא לא מופעל, ואיך לאחזר מידע על פעולות המרה קיימות.
בנוסף, כדי לעקוב אחרי רוב פעולות ההמרה, צריך לבצע פעולות נוספות. מידע נוסף על הסוגים השונים של פעולות המרה והדרישות שלהם זמין במאמר יצירת פעולות המרה.
הגדרת מעקב המרות באתר
אם אתם מתחילים להשתמש בייבוא של נתוני המרות אופליין, השלב הראשון הוא לפעול לפי השלבים במדריך הגדרת Google Tag לצורך שימוש בהמרות משופרות לצורך שיוך ללידים כדי להגדיר את האתר למעקב אחרי המרות משופרות לצורך שיוך ללידים. אפשר גם להשתמש ב-Google Tag Manager כדי להגדיר את האתר. לשם כך, פועלים לפי השלבים במדריך הגדרה של תיעוד המרות משופר לצורך שיוך ללידים באמצעות Google Tag Manager.
הפעלת מעקב המרות בחשבון ההמרות ב-Google Ads
אחזור מידע על ההגדרה של מעקב ההמרות
כדי לבדוק את ההגדרה של מעקב ההמרות בחשבון ולוודא שמעקב ההמרות מופעל, שולחים שאילתה למשאב Customer
לגבי ConversionTrackingSetting
.
מריצים את השאילתה הבאה באמצעות GoogleAdsService.SearchStream
:
SELECT
customer.conversion_tracking_setting.google_ads_conversion_customer,
customer.conversion_tracking_setting.conversion_tracking_status,
customer.conversion_tracking_setting.conversion_tracking_id,
customer.conversion_tracking_setting.cross_account_conversion_tracking_id
FROM customer
השדה google_ads_conversion_customer
מציין את חשבון Google Ads שיוצר ומנהל את ההמרות עבור הלקוח הזה. ללקוחות שמשתמשים במעקב המרות ברמת חשבון ניהול, זהו המזהה של חשבון ניהול. מספר הלקוח ב-Google Ads שמשויך להמרה צריך להיות מועבר כ-customer_id
בבקשות ל-Google Ads API ליצירה ולניהול של המרות.
הערה: השדה הזה מאוכלס גם אם מעקב ההמרות לא מופעל.
בשדה
conversion_tracking_status
מצוין אם מעקב ההמרות מופעל ואם החשבון
משתמש במעקב המרות ברמת חשבון ניהול.
יצירת פעולת המרה בחשבון הלקוח של ההמרות ב-Google Ads
אם הערך של conversion_tracking_status
הוא NOT_CONVERSION_TRACKED
, מעקב ההמרות לא מופעל בחשבון. מפעילים מעקב המרות על ידי יצירת לפחות ConversionAction
אחת בחשבון ההמרות ב-Google Ads, כמו בדוגמה הבאה. אפשרות אחרת היא ליצור פעולת המרה בממשק המשתמש. לשם כך, פועלים לפי ההוראות במרכז העזרה לסוג ההמרה שרוצים להפעיל.
שימו לב: התכונה 'המרות משופרות' מופעלת אוטומטית כששולחים נתונים דרך Google Ads API, אבל אפשר להשבית אותה דרך ממשק המשתמש של Google Ads.
קוד לדוגמה
Java
private void runExample(GoogleAdsClient googleAdsClient, long customerId) { // Creates a ConversionAction. ConversionAction conversionAction = ConversionAction.newBuilder() // Note that conversion action names must be unique. If a conversion action already // exists with the specified conversion_action_name the create operation will fail with // a ConversionActionError.DUPLICATE_NAME error. .setName("Earth to Mars Cruises Conversion #" + getPrintableDateTime()) .setCategory(ConversionActionCategory.DEFAULT) .setType(ConversionActionType.WEBPAGE) .setStatus(ConversionActionStatus.ENABLED) .setViewThroughLookbackWindowDays(15L) .setValueSettings( ValueSettings.newBuilder() .setDefaultValue(23.41) .setAlwaysUseDefaultValue(true) .build()) .build(); // Creates the operation. ConversionActionOperation operation = ConversionActionOperation.newBuilder().setCreate(conversionAction).build(); try (ConversionActionServiceClient conversionActionServiceClient = googleAdsClient.getLatestVersion().createConversionActionServiceClient()) { MutateConversionActionsResponse response = conversionActionServiceClient.mutateConversionActions( Long.toString(customerId), Collections.singletonList(operation)); System.out.printf("Added %d conversion actions:%n", response.getResultsCount()); for (MutateConversionActionResult result : response.getResultsList()) { System.out.printf( "New conversion action added with resource name: '%s'%n", result.getResourceName()); } } }
C#
public void Run(GoogleAdsClient client, long customerId) { // Get the ConversionActionService. ConversionActionServiceClient conversionActionService = client.GetService(Services.V20.ConversionActionService); // Note that conversion action names must be unique. // If a conversion action already exists with the specified name the create operation // will fail with a ConversionAction.DUPLICATE_NAME error. string ConversionActionName = "Earth to Mars Cruises Conversion #" + ExampleUtilities.GetRandomString(); // Add a conversion action. ConversionAction conversionAction = new ConversionAction() { Name = ConversionActionName, Category = ConversionActionCategory.Default, Type = ConversionActionType.Webpage, Status = ConversionActionStatus.Enabled, ViewThroughLookbackWindowDays = 15, ValueSettings = new ConversionAction.Types.ValueSettings() { DefaultValue = 23.41, AlwaysUseDefaultValue = true } }; // Create the operation. ConversionActionOperation operation = new ConversionActionOperation() { Create = conversionAction }; try { // Create the conversion action. MutateConversionActionsResponse response = conversionActionService.MutateConversionActions(customerId.ToString(), new ConversionActionOperation[] { operation }); // Display the results. foreach (MutateConversionActionResult newConversionAction in response.Results) { Console.WriteLine($"New conversion action with resource name = " + $"'{newConversionAction.ResourceName}' was added."); } } catch (GoogleAdsException e) { Console.WriteLine("Failure:"); Console.WriteLine($"Message: {e.Message}"); Console.WriteLine($"Failure: {e.Failure}"); Console.WriteLine($"Request ID: {e.RequestId}"); throw; } }
PHP
public static function runExample(GoogleAdsClient $googleAdsClient, int $customerId) { // Creates a conversion action. $conversionAction = new ConversionAction([ // Note that conversion action names must be unique. // If a conversion action already exists with the specified conversion_action_name // the create operation will fail with a ConversionActionError.DUPLICATE_NAME error. 'name' => 'Earth to Mars Cruises Conversion #' . Helper::getPrintableDatetime(), 'category' => ConversionActionCategory::PBDEFAULT, 'type' => ConversionActionType::WEBPAGE, 'status' => ConversionActionStatus::ENABLED, 'view_through_lookback_window_days' => 15, 'value_settings' => new ValueSettings([ 'default_value' => 23.41, 'always_use_default_value' => true ]) ]); // Creates a conversion action operation. $conversionActionOperation = new ConversionActionOperation(); $conversionActionOperation->setCreate($conversionAction); // Issues a mutate request to add the conversion action. $conversionActionServiceClient = $googleAdsClient->getConversionActionServiceClient(); $response = $conversionActionServiceClient->mutateConversionActions( MutateConversionActionsRequest::build($customerId, [$conversionActionOperation]) ); printf("Added %d conversion actions:%s", $response->getResults()->count(), PHP_EOL); foreach ($response->getResults() as $addedConversionAction) { /** @var ConversionAction $addedConversionAction */ printf( "New conversion action added with resource name: '%s'%s", $addedConversionAction->getResourceName(), PHP_EOL ); } }
Python
def main(client, customer_id): conversion_action_service = client.get_service("ConversionActionService") # Create the operation. conversion_action_operation = client.get_type("ConversionActionOperation") # Create conversion action. conversion_action = conversion_action_operation.create # Note that conversion action names must be unique. If a conversion action # already exists with the specified conversion_action_name, the create # operation will fail with a ConversionActionError.DUPLICATE_NAME error. conversion_action.name = f"Earth to Mars Cruises Conversion {uuid.uuid4()}" conversion_action.type_ = ( client.enums.ConversionActionTypeEnum.UPLOAD_CLICKS ) conversion_action.category = ( client.enums.ConversionActionCategoryEnum.DEFAULT ) conversion_action.status = client.enums.ConversionActionStatusEnum.ENABLED conversion_action.view_through_lookback_window_days = 15 # Create a value settings object. value_settings = conversion_action.value_settings value_settings.default_value = 15.0 value_settings.always_use_default_value = True # Add the conversion action. conversion_action_response = ( conversion_action_service.mutate_conversion_actions( customer_id=customer_id, operations=[conversion_action_operation], ) ) print( "Created conversion action " f'"{conversion_action_response.results[0].resource_name}".' )
Ruby
def add_conversion_action(customer_id) # GoogleAdsClient will read a config file from # ENV['HOME']/google_ads_config.rb when called without parameters client = Google::Ads::GoogleAds::GoogleAdsClient.new # Add a conversion action. conversion_action = client.resource.conversion_action do |ca| ca.name = "Earth to Mars Cruises Conversion #{(Time.new.to_f * 100).to_i}" ca.type = :UPLOAD_CLICKS ca.category = :DEFAULT ca.status = :ENABLED ca.view_through_lookback_window_days = 15 # Create a value settings object. ca.value_settings = client.resource.value_settings do |vs| vs.default_value = 15 vs.always_use_default_value = true end end # Create the operation. conversion_action_operation = client.operation.create_resource.conversion_action(conversion_action) # Add the ad group ad. response = client.service.conversion_action.mutate_conversion_actions( customer_id: customer_id, operations: [conversion_action_operation], ) puts "New conversion action with resource name = #{response.results.first.resource_name}." end
Perl
sub add_conversion_action { my ($api_client, $customer_id) = @_; # Note that conversion action names must be unique. # If a conversion action already exists with the specified conversion_action_name, # the create operation fails with error ConversionActionError.DUPLICATE_NAME. my $conversion_action_name = "Earth to Mars Cruises Conversion #" . uniqid(); # Create a conversion action. my $conversion_action = Google::Ads::GoogleAds::V20::Resources::ConversionAction->new({ name => $conversion_action_name, category => DEFAULT, type => WEBPAGE, status => ENABLED, viewThroughLookbackWindowDays => 15, valueSettings => Google::Ads::GoogleAds::V20::Resources::ValueSettings->new({ defaultValue => 23.41, alwaysUseDefaultValue => "true" })}); # Create a conversion action operation. my $conversion_action_operation = Google::Ads::GoogleAds::V20::Services::ConversionActionService::ConversionActionOperation ->new({create => $conversion_action}); # Add the conversion action. my $conversion_actions_response = $api_client->ConversionActionService()->mutate({ customerId => $customer_id, operations => [$conversion_action_operation]}); printf "New conversion action added with resource name: '%s'.\n", $conversion_actions_response->{results}[0]{resourceName}; return 1; }
מוודאים שהערך של conversion_action_type
מוגדר לערך הנכון של ConversionActionType
.
כאן אפשר לקבל הנחיות נוספות ליצירת פעולות המרה ב-Google Ads API.
אחזור של פעולת המרה קיימת
כדי לאחזר פרטים של פעולת המרה קיימת, שולחים את השאילתה הבאה. חשוב לוודא שמספר הלקוח בבקשה מוגדר ללקוח ההמרות ב-Google Ads שציינתם למעלה, וסוג פעולת ההמרה מוגדר לערך הנכון ConversionActionType
.
SELECT
conversion_action.resource_name,
conversion_action.name,
conversion_action.status
FROM conversion_action
WHERE conversion_action.type = 'INSERT_CONVERSION_ACTION_TYPE'
מעקב המרות ברמת חשבון ניהול
אם אתם משתמשים במעקב המרות ברמת חשבון ניהול, הפונקציה ConversionActionService
מחזירה את פעולות ההמרה הבאות:
- כל פעולות ההמרה שהוגדרו על ידי חשבון הניהול שבו נעשה שימוש בחשבון לצורך מעקב המרות ברמת חשבון ניהול
- כל פעולות ההמרה שבהן הלקוח צבר נתונים סטטיסטיים, כולל פעולות שהוגדרו על ידי המערכת ופעולות שנמצאות בבעלות חשבון הניהול, גם אם חשבון הניהול מבטל את הקישור בהמשך
- כל הפעולות שהלקוח הגדיר בחשבון שלו
- המרות מ-Analytics שנוצרו בנכסי Google Analytics מקושרים.
הנתון הזה כולל פעולות שקשורות להמרות ב-Analytics שלא יובאו אל Google Ads, עם סטטוס של
HIDDEN
.
החל מv19.1
, אפשר להשתמש ב-Google Ads API כדי להביע הסכמה להפעלת מעקב המרות חוצה-חשבונות כשיוצרים חשבונות לקוח.
כשיוצרים Customer
חדש, מגדירים את conversion_tracking_setting.google_ads_conversion_customer
לשם המשאב של חשבון הניהול שאמור לנהל את פעולות ההמרה בשם חשבון הלקוח.
בנוסף, חשבון הניהול הזה צריך להיות החשבון שממנו נשלחת create
הבקשה
לפתיחת חשבון הלקוח החדש.
החל מ-v20
, אפשר להשתמש ב-Google Ads API כדי להפעיל מעקב המרות חוצה-חשבונות גם כשיוצרים וגם כשמעדכנים חשבונות לקוח.
כשמעדכנים חשבון לקוח קיים, אפשר להפעיל מעקב המרות ברמת חשבון ניהול על ידי הגדרת השדה conversion_tracking_setting.google_ads_conversion_customer
. בשדה הזה צריך להגדיר את שם המשאב של חשבון הניהול שאמור לנהל פעולות המרה בשם חשבון הלקוח.
בנוסף, חשבון הניהול הזה צריך להיות החשבון שממנו נשלחה update
הבקשה לחשבון הלקוח.
כשמפעילים מעקב המרות ברמת חשבון ניהול או כשמחליפים את חשבון הניהול שמוגדר למעקב המרות בחשבון לקוח קיים, חלים אותם כללי זהירות כמו במקרה של ביצוע השינוי הזה בממשק המשתמש. באופן ספציפי:
- חשבון הלקוח יאמץ את כללי ברירת המחדל לקביעת ערך המרות ואת יעדי ברירת המחדל של מחזור החיים של הלקוחות במרכז החדש לניהול מעקב המרות.
- קמפיינים שמטרגטים פעולת המרה ספציפית יעברו לשימוש ביעדי ההמרה שמוגדרים כברירת מחדל בחשבון הניהול של ההמרות. אם תמשיכו לטרגט פעולת המרה ספציפית, יכול להיות שתיתקלו בהתנהגות לא עקבית, כי יכול להיות שבחשבון הניהול לא מוגדרים אותם יעדים כמו בחשבון הלקוח. חשוב לוודא שהקמפיינים עוברים אופטימיזציה להשגת היעדים הנכונים.
- אם חשבון משתייך ליותר מחשבון ניהול אחד, הוא יכול להשתמש בפעולות המרה רק ממנהל אחד. אם לא מצוין חשבון מעקב המרות, החשבון ישמש כחשבון מעקב המרות כברירת מחדל.
יצירה של פעולות המרה
כדי למדוד המרות, צריך להגדיר ConversionAction
לtype
של פעולת ההמרה שרוצים לעקוב אחריה. לדוגמה, רכישה באינטרנט ושיחת טלפון דורשות פעולות המרה שונות.
הדרך הכי טובה להגדיר פעולות המרה חדשות ב-API היא באמצעות דוגמת הקוד להוספת פעולת המרה שבהמשך. הדוגמה מטפלת בכל משימות האימות ברקע, ומסבירה איך ליצור ConversionAction
.
בנוסף, כדי לעקוב אחרי רוב פעולות ההמרה, צריך לבצע פעולות נוספות. לדוגמה, כדי לעקוב אחרי המרות באתר, צריך להוסיף קטע קוד שנקרא תג לדף ההמרה באתר. דרישות מפורטות לגבי סוגים אחרים של פעולות המרה זמינות במאמר הזה במרכז העזרה.
קוד לדוגמה
בדוגמת הקוד הבאה מוסבר איך ליצור פעולת המרה חדשה. באופן ספציפי, הוא יוצר פעולת המרה עם ההגדרה
type
שמוגדרת לערך
UPLOAD_CLICKS
.
היא גם מגדירה את category
ל-DEFAULT
.
הגדרות ברירת המחדל הבאות חלות:
Google Ads API מגדיר את השדה
primary_for_goal
באופן אוטומטי, אבל אתם יכולים להגדיר את השדה הזה באופן מפורש כדי לשלוט בהשפעה של פעולת המרה על הדיווח והבידינג בחשבון שלכם כשמשלבים אותה עם יעדי ההמרה שלכם .ב-Google Ads API, הערך של
counting_type
מוגדר אוטומטית ל-MANY_PER_CLICK
. פרטים נוספים זמינים במאמר מידע על האפשרויות לספירת המרות.ב-Google Ads API, מודל השיוך מוגדר כמבוסס-נתונים על ידי הגדרת השדה
attribution_model_settings
לערךGOOGLE_SEARCH_ATTRIBUTION_DATA_DRIVEN
שלAttributionModel
. מידע נוסף על מודלים של שיוך זמין במאמר הזה במרכז העזרה.
Java
private void runExample(GoogleAdsClient googleAdsClient, long customerId) { // Creates a ConversionAction. ConversionAction conversionAction = ConversionAction.newBuilder() // Note that conversion action names must be unique. If a conversion action already // exists with the specified conversion_action_name the create operation will fail with // a ConversionActionError.DUPLICATE_NAME error. .setName("Earth to Mars Cruises Conversion #" + getPrintableDateTime()) .setCategory(ConversionActionCategory.DEFAULT) .setType(ConversionActionType.WEBPAGE) .setStatus(ConversionActionStatus.ENABLED) .setViewThroughLookbackWindowDays(15L) .setValueSettings( ValueSettings.newBuilder() .setDefaultValue(23.41) .setAlwaysUseDefaultValue(true) .build()) .build(); // Creates the operation. ConversionActionOperation operation = ConversionActionOperation.newBuilder().setCreate(conversionAction).build(); try (ConversionActionServiceClient conversionActionServiceClient = googleAdsClient.getLatestVersion().createConversionActionServiceClient()) { MutateConversionActionsResponse response = conversionActionServiceClient.mutateConversionActions( Long.toString(customerId), Collections.singletonList(operation)); System.out.printf("Added %d conversion actions:%n", response.getResultsCount()); for (MutateConversionActionResult result : response.getResultsList()) { System.out.printf( "New conversion action added with resource name: '%s'%n", result.getResourceName()); } } }
C#
public void Run(GoogleAdsClient client, long customerId) { // Get the ConversionActionService. ConversionActionServiceClient conversionActionService = client.GetService(Services.V20.ConversionActionService); // Note that conversion action names must be unique. // If a conversion action already exists with the specified name the create operation // will fail with a ConversionAction.DUPLICATE_NAME error. string ConversionActionName = "Earth to Mars Cruises Conversion #" + ExampleUtilities.GetRandomString(); // Add a conversion action. ConversionAction conversionAction = new ConversionAction() { Name = ConversionActionName, Category = ConversionActionCategory.Default, Type = ConversionActionType.Webpage, Status = ConversionActionStatus.Enabled, ViewThroughLookbackWindowDays = 15, ValueSettings = new ConversionAction.Types.ValueSettings() { DefaultValue = 23.41, AlwaysUseDefaultValue = true } }; // Create the operation. ConversionActionOperation operation = new ConversionActionOperation() { Create = conversionAction }; try { // Create the conversion action. MutateConversionActionsResponse response = conversionActionService.MutateConversionActions(customerId.ToString(), new ConversionActionOperation[] { operation }); // Display the results. foreach (MutateConversionActionResult newConversionAction in response.Results) { Console.WriteLine($"New conversion action with resource name = " + $"'{newConversionAction.ResourceName}' was added."); } } catch (GoogleAdsException e) { Console.WriteLine("Failure:"); Console.WriteLine($"Message: {e.Message}"); Console.WriteLine($"Failure: {e.Failure}"); Console.WriteLine($"Request ID: {e.RequestId}"); throw; } }
PHP
public static function runExample(GoogleAdsClient $googleAdsClient, int $customerId) { // Creates a conversion action. $conversionAction = new ConversionAction([ // Note that conversion action names must be unique. // If a conversion action already exists with the specified conversion_action_name // the create operation will fail with a ConversionActionError.DUPLICATE_NAME error. 'name' => 'Earth to Mars Cruises Conversion #' . Helper::getPrintableDatetime(), 'category' => ConversionActionCategory::PBDEFAULT, 'type' => ConversionActionType::WEBPAGE, 'status' => ConversionActionStatus::ENABLED, 'view_through_lookback_window_days' => 15, 'value_settings' => new ValueSettings([ 'default_value' => 23.41, 'always_use_default_value' => true ]) ]); // Creates a conversion action operation. $conversionActionOperation = new ConversionActionOperation(); $conversionActionOperation->setCreate($conversionAction); // Issues a mutate request to add the conversion action. $conversionActionServiceClient = $googleAdsClient->getConversionActionServiceClient(); $response = $conversionActionServiceClient->mutateConversionActions( MutateConversionActionsRequest::build($customerId, [$conversionActionOperation]) ); printf("Added %d conversion actions:%s", $response->getResults()->count(), PHP_EOL); foreach ($response->getResults() as $addedConversionAction) { /** @var ConversionAction $addedConversionAction */ printf( "New conversion action added with resource name: '%s'%s", $addedConversionAction->getResourceName(), PHP_EOL ); } }
Python
def main(client, customer_id): conversion_action_service = client.get_service("ConversionActionService") # Create the operation. conversion_action_operation = client.get_type("ConversionActionOperation") # Create conversion action. conversion_action = conversion_action_operation.create # Note that conversion action names must be unique. If a conversion action # already exists with the specified conversion_action_name, the create # operation will fail with a ConversionActionError.DUPLICATE_NAME error. conversion_action.name = f"Earth to Mars Cruises Conversion {uuid.uuid4()}" conversion_action.type_ = ( client.enums.ConversionActionTypeEnum.UPLOAD_CLICKS ) conversion_action.category = ( client.enums.ConversionActionCategoryEnum.DEFAULT ) conversion_action.status = client.enums.ConversionActionStatusEnum.ENABLED conversion_action.view_through_lookback_window_days = 15 # Create a value settings object. value_settings = conversion_action.value_settings value_settings.default_value = 15.0 value_settings.always_use_default_value = True # Add the conversion action. conversion_action_response = ( conversion_action_service.mutate_conversion_actions( customer_id=customer_id, operations=[conversion_action_operation], ) ) print( "Created conversion action " f'"{conversion_action_response.results[0].resource_name}".' )
Ruby
def add_conversion_action(customer_id) # GoogleAdsClient will read a config file from # ENV['HOME']/google_ads_config.rb when called without parameters client = Google::Ads::GoogleAds::GoogleAdsClient.new # Add a conversion action. conversion_action = client.resource.conversion_action do |ca| ca.name = "Earth to Mars Cruises Conversion #{(Time.new.to_f * 100).to_i}" ca.type = :UPLOAD_CLICKS ca.category = :DEFAULT ca.status = :ENABLED ca.view_through_lookback_window_days = 15 # Create a value settings object. ca.value_settings = client.resource.value_settings do |vs| vs.default_value = 15 vs.always_use_default_value = true end end # Create the operation. conversion_action_operation = client.operation.create_resource.conversion_action(conversion_action) # Add the ad group ad. response = client.service.conversion_action.mutate_conversion_actions( customer_id: customer_id, operations: [conversion_action_operation], ) puts "New conversion action with resource name = #{response.results.first.resource_name}." end
Perl
sub add_conversion_action { my ($api_client, $customer_id) = @_; # Note that conversion action names must be unique. # If a conversion action already exists with the specified conversion_action_name, # the create operation fails with error ConversionActionError.DUPLICATE_NAME. my $conversion_action_name = "Earth to Mars Cruises Conversion #" . uniqid(); # Create a conversion action. my $conversion_action = Google::Ads::GoogleAds::V20::Resources::ConversionAction->new({ name => $conversion_action_name, category => DEFAULT, type => WEBPAGE, status => ENABLED, viewThroughLookbackWindowDays => 15, valueSettings => Google::Ads::GoogleAds::V20::Resources::ValueSettings->new({ defaultValue => 23.41, alwaysUseDefaultValue => "true" })}); # Create a conversion action operation. my $conversion_action_operation = Google::Ads::GoogleAds::V20::Services::ConversionActionService::ConversionActionOperation ->new({create => $conversion_action}); # Add the conversion action. my $conversion_actions_response = $api_client->ConversionActionService()->mutate({ customerId => $customer_id, operations => [$conversion_action_operation]}); printf "New conversion action added with resource name: '%s'.\n", $conversion_actions_response->{results}[0]{resourceName}; return 1; }
אפשר לראות את הדוגמה הזו בתיקייה Remarketing (רימרקטינג) בספריית הלקוח ובאוסף דוגמאות הקוד: דוגמה להוספת קוד של פעולת המרה.
פורמטים מאושרים
Google Ads וממשק Google Ads API תומכים במגוון רחב של פעולות המרה, ולכן חלק מכללי האימות משתנים בהתאם לtype
של הפעולה.
השגיאה הנפוצה ביותר ביצירת פעולת המרה היא DUPLICATE_NAME
.
חשוב לוודא שאתם משתמשים בשם ייחודי לכל פעולת המרה.
כמה טיפים להגדרת השדות ConversionAction
:
- כל שדות ה-enum
- ניסיון להגדיר שדה enum כלשהו ל-
UNKNOWN
יוביל לשגיאתRequestError.INVALID_ENUM_VALUE
. app_id
- המאפיין
app_id
הוא קבוע וניתן להגדרה רק כשיוצרים המרה חדשה באפליקציה. attribution_model_settings
- הגדרת האפשרות הזו לאפשרות שהוצאה משימוש תגרום לשגיאה
CANNOT_SET_RULE_BASED_ATTRIBUTION_MODELS
. Google Ads תומך רק ב-GOOGLE_ADS_LAST_CLICK
וב-GOOGLE_SEARCH_ATTRIBUTION_DATA_DRIVEN
. click_through_lookback_window_days
הגדרת ערך במאפיין הזה מחוץ לטווח המותר תוביל לשגיאה
RangeError.TOO_LOW
אוRangeError.TOO_HIGH
.הערך של המאפיין הזה צריך להיות בטווח
[1,60]
עבור פעולת המרה מסוגAD_CALL
אוWEBSITE_CALL
. ברוב פעולות ההמרה האחרות, הטווח המותר הוא[1,30]
.include_in_conversions_metric
הגדרת הערך הזה בפעולה
create
אוupdate
נכשלת עם שגיאהFieldError.IMMUTABLE_FIELD
. במקום זאת, מגדירים אתprimary_for_goal
כמו שמתואר במדריך ליעדי המרה.phone_call_duration_seconds
ניסיון להגדיר את המאפיין הזה בפעולת המרה שלא מיועדת לשיחות יוביל לשגיאה
FieldError.VALUE_MUST_BE_UNSET
.type
המאפיין
type
הוא קבוע וניתן להגדרה רק כשיוצרים המרה חדשה.עדכון של פעולת המרה עם
type
ששווה ל-UNKNOWN
מוביל לשגיאהMutateError.MUTATE_NOT_ALLOWED
.value_settings
הערך
value_settings
של פעולת המרה מסוגWEBSITE_CALL
אוAD_CALL
צריך להיותtrue
.always_use_default_value
אם מציינים ערך שלfalse
כשיוצרים או מעדכנים את הערך הזה, מוצגת שגיאהINVALID_VALUE
.view_through_lookback_window_days
הגדרת ערך במאפיין הזה מחוץ לטווח המותר תוביל לשגיאה
RangeError.TOO_LOW
אוRangeError.TOO_HIGH
. ברוב פעולות ההמרה, הטווח המותר הוא[1,30]
.אי אפשר להגדיר את המאפיין הזה בפעולות המרה מסוג
AD_CALL
אוWEBSITE_CALL
. ציון ערך יוביל לשגיאהVALUE_MUST_BE_UNSET
.