google-adwords-api 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +9 -0
- data/README +26 -10
- data/Rakefile +1 -1
- data/examples/v200909/add_ad_group.rb +2 -2
- data/examples/v200909/add_ads.rb +4 -4
- data/examples/v200909/add_campaign.rb +2 -2
- data/examples/v200909/check_campaigns.rb +4 -4
- data/examples/v201003/add_ad_group.rb +2 -2
- data/examples/v201003/add_ads.rb +6 -6
- data/examples/v201003/add_campaign.rb +2 -2
- data/examples/v201003/add_keywords_performance_report_definition.rb +2 -2
- data/examples/v201003/check_campaigns.rb +4 -4
- data/examples/v201008/add_ad_group.rb +2 -2
- data/examples/v201008/add_ads.rb +7 -7
- data/examples/v201008/add_campaign.rb +2 -2
- data/examples/v201008/add_experiment.rb +5 -5
- data/examples/v201008/add_keywords_performance_report_definition.rb +2 -2
- data/examples/v201008/add_user_list.rb +2 -2
- data/examples/v201008/check_campaigns.rb +4 -4
- data/examples/v201008/get_account_hierarchy.rb +8 -11
- data/examples/v201101/add_ad_group.rb +2 -2
- data/examples/v201101/add_ads.rb +6 -6
- data/examples/v201101/add_campaign.rb +2 -2
- data/examples/v201101/add_conversion.rb +4 -4
- data/examples/v201101/add_experiment.rb +5 -5
- data/examples/v201101/add_keywords_performance_report_definition.rb +2 -2
- data/examples/v201101/add_user_list.rb +3 -3
- data/examples/v201101/check_campaigns.rb +4 -4
- data/examples/v201101/get_account_hierarchy.rb +7 -9
- data/examples/v201109/add_ad_extension_override.rb +82 -0
- data/examples/v201109/add_ad_group.rb +89 -0
- data/examples/v201109/add_ad_group_criteria.rb +109 -0
- data/examples/v201109/add_ads.rb +174 -0
- data/examples/v201109/add_campaign.rb +99 -0
- data/examples/v201109/add_campaign_ad_extension.rb +121 -0
- data/examples/v201109/add_campaign_targeting_criteria.rb +102 -0
- data/examples/{v201101/add_mcc_report_definition.rb → v201109/add_conversion.rb} +26 -28
- data/examples/v201109/add_experiment.rb +153 -0
- data/examples/v201109/add_negative_campaign_criterion.rb +87 -0
- data/examples/v201109/add_user_list.rb +113 -0
- data/examples/v201109/check_campaigns.rb +123 -0
- data/examples/v201109/delete_ad.rb +85 -0
- data/examples/v201109/delete_ad_group.rb +77 -0
- data/examples/v201109/delete_ad_group_criterion.rb +86 -0
- data/examples/v201109/delete_bulk_mutate_job.rb +87 -0
- data/examples/v201109/delete_campaign.rb +78 -0
- data/examples/v201109/delete_experiment.rb +78 -0
- data/examples/v201109/delete_user_list.rb +78 -0
- data/examples/v201109/download_adhoc_report.rb +79 -0
- data/examples/v201109/download_report.rb +67 -0
- data/examples/v201109/get_account_hierarchy.rb +93 -0
- data/examples/v201109/get_ad_group_bid_landscape.rb +94 -0
- data/examples/v201109/get_all_account_changes.rb +137 -0
- data/examples/v201109/get_all_active_ad_group_criteria.rb +98 -0
- data/examples/v201109/get_all_ad_extension_overrides.rb +82 -0
- data/examples/v201109/get_all_ad_group_criteria.rb +90 -0
- data/examples/v201109/get_all_ad_groups.rb +85 -0
- data/examples/v201109/get_all_ad_params.rb +86 -0
- data/examples/v201109/get_all_ads.rb +90 -0
- data/examples/v201109/get_all_campaign_ad_extensions.rb +87 -0
- data/examples/v201109/get_all_campaign_targets.rb +74 -0
- data/examples/v201109/get_all_campaigns.rb +77 -0
- data/examples/v201109/get_all_carriers.rb +72 -0
- data/examples/v201109/get_all_conversions.rb +79 -0
- data/examples/v201109/get_all_disapproved_ads.rb +93 -0
- data/examples/v201109/get_all_experiments.rb +89 -0
- data/examples/v201109/get_all_images.rb +82 -0
- data/examples/v201109/get_all_languages.rb +73 -0
- data/examples/v201109/get_all_paused_campaigns.rb +83 -0
- data/examples/v201109/get_all_report_definitions.rb +75 -0
- data/examples/v201109/get_all_user_lists.rb +78 -0
- data/examples/v201109/get_all_videos.rb +78 -0
- data/examples/v201109/get_bulk_mutate_job.rb +97 -0
- data/examples/v201109/get_campaign_alerts.rb +95 -0
- data/examples/v201109/get_client_customer_id.rb +87 -0
- data/examples/v201109/get_conversion_optimizer_eligibility.rb +93 -0
- data/examples/v201109/get_criterion_bid_landscape.rb +93 -0
- data/examples/v201109/get_geo_location_info.rb +99 -0
- data/examples/v201109/get_keyword_opportunities.rb +95 -0
- data/examples/v201109/get_location_criteria.rb +103 -0
- data/examples/v201109/get_method_cost.rb +87 -0
- data/examples/v201109/get_operation_count.rb +79 -0
- data/examples/v201109/get_related_keywords.rb +108 -0
- data/examples/v201109/get_related_placements.rb +107 -0
- data/examples/v201109/get_report_fields.rb +72 -0
- data/examples/v201109/get_total_usage_units_per_month.rb +74 -0
- data/examples/v201109/get_traffic_estimates.rb +129 -0
- data/examples/v201109/get_unit_count.rb +81 -0
- data/examples/v201109/handle_partial_failures.rb +127 -0
- data/examples/v201109/handle_policy_violation_error.rb +138 -0
- data/examples/v201109/handle_second_factor.rb +87 -0
- data/examples/v201109/oauth_handling.rb +95 -0
- data/examples/v201109/perform_bulk_mutate_job.rb +212 -0
- data/examples/v201109/perform_mutate_job.rb +177 -0
- data/examples/v201109/promote_experiment.rb +79 -0
- data/examples/v201109/set_ad_params.rb +115 -0
- data/examples/v201109/update_ad.rb +86 -0
- data/examples/v201109/update_ad_group.rb +81 -0
- data/examples/v201109/update_ad_group_criterion.rb +99 -0
- data/examples/v201109/update_campaign.rb +84 -0
- data/examples/v201109/update_conversion.rb +87 -0
- data/examples/v201109/update_user_list.rb +82 -0
- data/examples/v201109/upload_image.rb +90 -0
- data/lib/adwords_api.rb +54 -50
- data/lib/adwords_api/api_config.rb +70 -14
- data/lib/adwords_api/credential_handler.rb +32 -13
- data/lib/adwords_api/errors.rb +12 -0
- data/lib/adwords_api/extensions.rb +8 -118
- data/lib/adwords_api/report_utils.rb +198 -0
- data/lib/adwords_api/utils.rb +5 -2
- data/lib/adwords_api/v13/account_service.rb +11 -11
- data/lib/adwords_api/v13/account_service_registry.rb +5 -3
- data/lib/adwords_api/v13/report_service.rb +15 -15
- data/lib/adwords_api/v13/report_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/ad_extension_override_service.rb +5 -5
- data/lib/adwords_api/v200909/ad_extension_override_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/ad_group_ad_service.rb +5 -5
- data/lib/adwords_api/v200909/ad_group_ad_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/ad_group_criterion_service.rb +5 -5
- data/lib/adwords_api/v200909/ad_group_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/ad_group_service.rb +5 -5
- data/lib/adwords_api/v200909/ad_group_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/ad_param_service.rb +5 -5
- data/lib/adwords_api/v200909/ad_param_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/bulk_mutate_job_service.rb +5 -5
- data/lib/adwords_api/v200909/bulk_mutate_job_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/campaign_ad_extension_service.rb +5 -5
- data/lib/adwords_api/v200909/campaign_ad_extension_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/campaign_criterion_service.rb +5 -5
- data/lib/adwords_api/v200909/campaign_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/campaign_service.rb +5 -5
- data/lib/adwords_api/v200909/campaign_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/campaign_target_service.rb +5 -5
- data/lib/adwords_api/v200909/campaign_target_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/geo_location_service.rb +3 -3
- data/lib/adwords_api/v200909/geo_location_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/info_service.rb +3 -3
- data/lib/adwords_api/v200909/info_service_registry.rb +5 -3
- data/lib/adwords_api/v200909/targeting_idea_service.rb +5 -5
- data/lib/adwords_api/v200909/targeting_idea_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/ad_extension_override_service.rb +5 -5
- data/lib/adwords_api/v201003/ad_extension_override_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/ad_group_ad_service.rb +5 -5
- data/lib/adwords_api/v201003/ad_group_ad_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/ad_group_criterion_service.rb +5 -5
- data/lib/adwords_api/v201003/ad_group_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/ad_group_service.rb +5 -5
- data/lib/adwords_api/v201003/ad_group_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/ad_param_service.rb +5 -5
- data/lib/adwords_api/v201003/ad_param_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/bid_landscape_service.rb +3 -3
- data/lib/adwords_api/v201003/bid_landscape_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/bulk_mutate_job_service.rb +5 -5
- data/lib/adwords_api/v201003/bulk_mutate_job_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/campaign_ad_extension_service.rb +5 -5
- data/lib/adwords_api/v201003/campaign_ad_extension_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/campaign_criterion_service.rb +5 -5
- data/lib/adwords_api/v201003/campaign_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/campaign_service.rb +5 -5
- data/lib/adwords_api/v201003/campaign_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/campaign_target_service.rb +5 -5
- data/lib/adwords_api/v201003/campaign_target_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/geo_location_service.rb +3 -3
- data/lib/adwords_api/v201003/geo_location_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/info_service.rb +3 -3
- data/lib/adwords_api/v201003/info_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/media_service.rb +5 -5
- data/lib/adwords_api/v201003/media_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/report_definition_service.rb +7 -7
- data/lib/adwords_api/v201003/report_definition_service_registry.rb +5 -3
- data/lib/adwords_api/v201003/targeting_idea_service.rb +5 -5
- data/lib/adwords_api/v201003/targeting_idea_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/ad_extension_override_service.rb +5 -5
- data/lib/adwords_api/v201008/ad_extension_override_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/ad_group_ad_service.rb +5 -5
- data/lib/adwords_api/v201008/ad_group_ad_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/ad_group_criterion_service.rb +5 -5
- data/lib/adwords_api/v201008/ad_group_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/ad_group_service.rb +5 -5
- data/lib/adwords_api/v201008/ad_group_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/ad_param_service.rb +5 -5
- data/lib/adwords_api/v201008/ad_param_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/alert_service.rb +3 -3
- data/lib/adwords_api/v201008/alert_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/bid_landscape_service.rb +3 -3
- data/lib/adwords_api/v201008/bid_landscape_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/bulk_mutate_job_service.rb +5 -5
- data/lib/adwords_api/v201008/bulk_mutate_job_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/campaign_ad_extension_service.rb +5 -5
- data/lib/adwords_api/v201008/campaign_ad_extension_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/campaign_criterion_service.rb +5 -5
- data/lib/adwords_api/v201008/campaign_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/campaign_service.rb +5 -5
- data/lib/adwords_api/v201008/campaign_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/campaign_target_service.rb +5 -5
- data/lib/adwords_api/v201008/campaign_target_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/customer_sync_service.rb +3 -3
- data/lib/adwords_api/v201008/customer_sync_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/experiment_service.rb +5 -5
- data/lib/adwords_api/v201008/experiment_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/geo_location_service.rb +3 -3
- data/lib/adwords_api/v201008/geo_location_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/info_service.rb +3 -3
- data/lib/adwords_api/v201008/info_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/media_service.rb +5 -5
- data/lib/adwords_api/v201008/media_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/report_definition_service.rb +7 -7
- data/lib/adwords_api/v201008/report_definition_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/serviced_account_service.rb +3 -3
- data/lib/adwords_api/v201008/serviced_account_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/targeting_idea_service.rb +5 -5
- data/lib/adwords_api/v201008/targeting_idea_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/traffic_estimator_service.rb +3 -3
- data/lib/adwords_api/v201008/traffic_estimator_service_registry.rb +5 -3
- data/lib/adwords_api/v201008/user_list_service.rb +5 -5
- data/lib/adwords_api/v201008/user_list_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/ad_extension_override_service.rb +5 -5
- data/lib/adwords_api/v201101/ad_extension_override_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/ad_group_ad_service.rb +5 -5
- data/lib/adwords_api/v201101/ad_group_ad_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/ad_group_criterion_service.rb +5 -5
- data/lib/adwords_api/v201101/ad_group_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/ad_group_service.rb +5 -5
- data/lib/adwords_api/v201101/ad_group_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/ad_param_service.rb +5 -5
- data/lib/adwords_api/v201101/ad_param_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/alert_service.rb +3 -3
- data/lib/adwords_api/v201101/alert_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/bulk_mutate_job_service.rb +5 -5
- data/lib/adwords_api/v201101/bulk_mutate_job_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/bulk_opportunity_service.rb +3 -3
- data/lib/adwords_api/v201101/bulk_opportunity_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/campaign_ad_extension_service.rb +5 -5
- data/lib/adwords_api/v201101/campaign_ad_extension_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/campaign_criterion_service.rb +5 -5
- data/lib/adwords_api/v201101/campaign_criterion_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/campaign_service.rb +5 -5
- data/lib/adwords_api/v201101/campaign_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/campaign_target_service.rb +5 -5
- data/lib/adwords_api/v201101/campaign_target_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/conversion_tracker_service.rb +5 -5
- data/lib/adwords_api/v201101/conversion_tracker_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/customer_sync_service.rb +3 -3
- data/lib/adwords_api/v201101/customer_sync_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/data_service.rb +5 -5
- data/lib/adwords_api/v201101/data_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/experiment_service.rb +5 -5
- data/lib/adwords_api/v201101/experiment_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/geo_location_service.rb +3 -3
- data/lib/adwords_api/v201101/geo_location_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/info_service.rb +3 -3
- data/lib/adwords_api/v201101/info_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/media_service.rb +5 -5
- data/lib/adwords_api/v201101/media_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/report_definition_service.rb +7 -15
- data/lib/adwords_api/v201101/report_definition_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/serviced_account_service.rb +3 -3
- data/lib/adwords_api/v201101/serviced_account_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/targeting_idea_service.rb +5 -5
- data/lib/adwords_api/v201101/targeting_idea_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/traffic_estimator_service.rb +3 -3
- data/lib/adwords_api/v201101/traffic_estimator_service_registry.rb +5 -3
- data/lib/adwords_api/v201101/user_list_service.rb +5 -5
- data/lib/adwords_api/v201101/user_list_service_registry.rb +5 -3
- data/lib/adwords_api/v201109/ad_extension_override_service.rb +36 -0
- data/lib/adwords_api/v201109/ad_extension_override_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/ad_group_ad_service.rb +36 -0
- data/lib/adwords_api/v201109/ad_group_ad_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/ad_group_criterion_service.rb +36 -0
- data/lib/adwords_api/v201109/ad_group_criterion_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/ad_group_service.rb +36 -0
- data/lib/adwords_api/v201109/ad_group_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/ad_param_service.rb +36 -0
- data/lib/adwords_api/v201109/ad_param_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/alert_service.rb +32 -0
- data/lib/adwords_api/v201109/alert_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/bulk_mutate_job_service.rb +36 -0
- data/lib/adwords_api/v201109/bulk_mutate_job_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/bulk_opportunity_service.rb +32 -0
- data/lib/adwords_api/v201109/bulk_opportunity_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/campaign_ad_extension_service.rb +36 -0
- data/lib/adwords_api/v201109/campaign_ad_extension_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/campaign_criterion_service.rb +36 -0
- data/lib/adwords_api/v201109/campaign_criterion_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/campaign_service.rb +36 -0
- data/lib/adwords_api/v201109/campaign_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/campaign_target_service.rb +36 -0
- data/lib/adwords_api/v201109/campaign_target_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/constant_data_service.rb +36 -0
- data/lib/adwords_api/v201109/constant_data_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/conversion_tracker_service.rb +36 -0
- data/lib/adwords_api/v201109/conversion_tracker_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/customer_sync_service.rb +32 -0
- data/lib/adwords_api/v201109/customer_sync_service_registry.rb +45 -0
- data/lib/adwords_api/v201109/data_service.rb +36 -0
- data/lib/adwords_api/v201109/data_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/experiment_service.rb +36 -0
- data/lib/adwords_api/v201109/experiment_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/geo_location_service.rb +32 -0
- data/lib/adwords_api/v201109/geo_location_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/info_service.rb +32 -0
- data/lib/adwords_api/v201109/info_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/location_criterion_service.rb +32 -0
- data/lib/adwords_api/v201109/location_criterion_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/media_service.rb +36 -0
- data/lib/adwords_api/v201109/media_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/mutate_job_service.rb +40 -0
- data/lib/adwords_api/v201109/mutate_job_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/report_definition_service.rb +45 -0
- data/lib/adwords_api/v201109/report_definition_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/serviced_account_service.rb +32 -0
- data/lib/adwords_api/v201109/serviced_account_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/targeting_idea_service.rb +36 -0
- data/lib/adwords_api/v201109/targeting_idea_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/traffic_estimator_service.rb +32 -0
- data/lib/adwords_api/v201109/traffic_estimator_service_registry.rb +44 -0
- data/lib/adwords_api/v201109/user_list_service.rb +36 -0
- data/lib/adwords_api/v201109/user_list_service_registry.rb +44 -0
- data/test/bugs/test_issue_00000031.rb +78 -0
- metadata +467 -342
- data/examples/v201101/download_mcc_report.rb +0 -113
- data/examples/v201101/download_mcc_report_as_file.rb +0 -114
- data/lib/adwords_api/v13/traffic_estimator_service.rb +0 -44
- data/lib/adwords_api/v13/traffic_estimator_service_registry.rb +0 -39
@@ -0,0 +1,102 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
|
+
#
|
7
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
+
# implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
# This example adds various types of targeting criteria to a campaign. To get
|
21
|
+
# campaigns list, run get_all_campaigns.rb.
|
22
|
+
#
|
23
|
+
# Tags: CampaignCriterionService.mutate
|
24
|
+
|
25
|
+
require 'rubygems'
|
26
|
+
require 'adwords_api'
|
27
|
+
|
28
|
+
API_VERSION = :v201109
|
29
|
+
|
30
|
+
def get_location_criteria()
|
31
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
32
|
+
# when called without parameters.
|
33
|
+
adwords = AdwordsApi::Api.new
|
34
|
+
|
35
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
36
|
+
# the configuration file or provide your own logger:
|
37
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
38
|
+
|
39
|
+
campaign_criterion_srv =
|
40
|
+
adwords.service(:CampaignCriterionService, API_VERSION)
|
41
|
+
|
42
|
+
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'
|
43
|
+
|
44
|
+
# Create campaign criteria.
|
45
|
+
campaign_criteria = [
|
46
|
+
# Location criteria. The IDs can be found in the documentation or retrieved
|
47
|
+
# with the LocationCriterionService.
|
48
|
+
{:xsi_type => 'Location', :id => 21137}, # California, USA
|
49
|
+
{:xsi_type => 'Location', :id => 2484}, # Mexico
|
50
|
+
# Language criteria. The IDs can be found in the documentation or retrieved
|
51
|
+
# with the ConstantDataService.
|
52
|
+
{:xsi_type => 'Language', :id => 1000}, # English
|
53
|
+
{:xsi_type => 'Language', :id => 1003}, # Spanish
|
54
|
+
# Platform criteria. The IDs can be found in the documentation.
|
55
|
+
{:xsi_type => 'Platform', :id => 30001}, # Mobile
|
56
|
+
{:xsi_type => 'Platform', :id => 30002} # Tablets
|
57
|
+
]
|
58
|
+
|
59
|
+
# Create operations.
|
60
|
+
operations = campaign_criteria.map do |criterion|
|
61
|
+
{:operator => 'ADD',
|
62
|
+
:operand => {
|
63
|
+
:campaign_id => campaign_id,
|
64
|
+
:criterion => criterion}
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
response = campaign_criterion_srv.mutate(operations)
|
69
|
+
|
70
|
+
if response and response[:value]
|
71
|
+
criteria = response[:value]
|
72
|
+
criteria.each do |campaign_criterion|
|
73
|
+
criterion = campaign_criterion[:criterion]
|
74
|
+
puts ("Campaign criterion with campaign ID %d, criterion ID %d and " +
|
75
|
+
"type '%s' was added.") % [campaign_criterion[:campaign_id],
|
76
|
+
criterion[:id], criterion[:criterion_type]]
|
77
|
+
end
|
78
|
+
else
|
79
|
+
puts 'No criteria were returned.'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
if __FILE__ == $0
|
84
|
+
begin
|
85
|
+
get_location_criteria()
|
86
|
+
|
87
|
+
# HTTP errors.
|
88
|
+
rescue AdsCommon::Errors::HttpError => e
|
89
|
+
puts "HTTP Error: %s" % e
|
90
|
+
|
91
|
+
# API errors.
|
92
|
+
rescue AdwordsApi::Errors::ApiException => e
|
93
|
+
puts "Message: %s" % e.message
|
94
|
+
puts 'Errors:'
|
95
|
+
e.errors.each_with_index do |error, index|
|
96
|
+
puts "\tError [%d]:" % (index + 1)
|
97
|
+
error.each do |field, value|
|
98
|
+
puts "\t\t%s: %s" % [field, value]
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
#
|
3
|
-
# Author:: api.
|
3
|
+
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
|
4
4
|
#
|
5
5
|
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
6
|
#
|
@@ -17,20 +17,16 @@
|
|
17
17
|
# See the License for the specific language governing permissions and
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
|
-
# This example
|
21
|
-
# get_all_ad_groups.rb. To get report fields, run get_report_fields.rb.
|
20
|
+
# This example illustrates how to add an AdWords conversion.
|
22
21
|
#
|
23
|
-
#
|
24
|
-
# is released.
|
25
|
-
#
|
26
|
-
# Tags: ReportDefinitionService.mutate
|
22
|
+
# Tags: ConversionTrackerService.mutate
|
27
23
|
|
28
24
|
require 'rubygems'
|
29
25
|
require 'adwords_api'
|
30
26
|
|
31
|
-
API_VERSION = :
|
27
|
+
API_VERSION = :v201109
|
32
28
|
|
33
|
-
def
|
29
|
+
def add_conversion()
|
34
30
|
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
35
31
|
# when called without parameters.
|
36
32
|
adwords = AdwordsApi::Api.new
|
@@ -39,38 +35,40 @@ def add_mcc_report_definition()
|
|
39
35
|
# the configuration file or provide your own logger:
|
40
36
|
# adwords.logger = Logger.new('adwords_xml.log')
|
41
37
|
|
42
|
-
|
38
|
+
conv_tracker_srv = adwords.service(:ConversionTrackerService, API_VERSION)
|
43
39
|
|
44
|
-
# Prepare for adding
|
40
|
+
# Prepare for adding conversion.
|
45
41
|
operation = {
|
46
42
|
:operator => 'ADD',
|
47
43
|
:operand => {
|
48
|
-
|
49
|
-
|
44
|
+
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
45
|
+
# being created. It's only necessary when you must provide an explicit
|
46
|
+
# type that the client library can't infer.
|
47
|
+
:xsi_type => 'AdWordsConversionTracker',
|
48
|
+
:name => "Earth to Mars Cruises Conversion #%d" %
|
50
49
|
(Time.new.to_f * 1000).to_i,
|
51
|
-
:
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
:date_range_type => 'LAST_MONTH',
|
56
|
-
:download_format => 'XML',
|
57
|
-
:cross_client => true
|
50
|
+
:category => 'DEFAULT',
|
51
|
+
:markup_language => 'HTML',
|
52
|
+
:http_protocol => 'HTTP',
|
53
|
+
:text_format => 'HIDDEN'
|
58
54
|
}
|
59
55
|
}
|
60
56
|
|
61
|
-
# Add
|
62
|
-
response =
|
63
|
-
if response
|
64
|
-
response.
|
65
|
-
|
66
|
-
|
67
|
-
|
57
|
+
# Add conversion.
|
58
|
+
response = conv_tracker_srv.mutate([operation])
|
59
|
+
if response and response[:value]
|
60
|
+
conversion = response[:value].first
|
61
|
+
puts "Conversion with ID #{conversion[:id]}, name " +
|
62
|
+
"'#{conversion[:name]}', status '#{conversion[:status]}' and " +
|
63
|
+
" category '#{conversion[:category]}' was added."
|
64
|
+
else
|
65
|
+
puts 'No conversions were added.'
|
68
66
|
end
|
69
67
|
end
|
70
68
|
|
71
69
|
if __FILE__ == $0
|
72
70
|
begin
|
73
|
-
|
71
|
+
add_conversion()
|
74
72
|
|
75
73
|
# HTTP errors.
|
76
74
|
rescue AdsCommon::Errors::HttpError => e
|
@@ -0,0 +1,153 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
|
+
#
|
7
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
+
# implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
# This example creates an experiment using a query percentage of 10, which
|
21
|
+
# defines what fraction of auctions should go to the control split (90%) vs.
|
22
|
+
# the experiment split (10%), then adds experimental bid changes for criteria
|
23
|
+
# and ad groups. To get campaigns, run get_all_campaigns.rb. To get ad groups,
|
24
|
+
# run get_all_ad_groups.rb. To get criteria, run get_all_ad_group_criteria.rb.
|
25
|
+
#
|
26
|
+
# Tags: ExperimentService.mutate
|
27
|
+
|
28
|
+
require 'rubygems'
|
29
|
+
require 'adwords_api'
|
30
|
+
|
31
|
+
API_VERSION = :v201109
|
32
|
+
|
33
|
+
def add_experiment()
|
34
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
35
|
+
# when called without parameters.
|
36
|
+
adwords = AdwordsApi::Api.new
|
37
|
+
|
38
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
39
|
+
# the configuration file or provide your own logger:
|
40
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
41
|
+
|
42
|
+
experiment_srv = adwords.service(:ExperimentService, API_VERSION)
|
43
|
+
ad_group_srv = adwords.service(:AdGroupService, API_VERSION)
|
44
|
+
ad_group_criterion_srv =
|
45
|
+
adwords.service(:AdGroupCriterionService, API_VERSION)
|
46
|
+
|
47
|
+
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
48
|
+
ad_group_id = 'INSERT_AD_GROUP_ID_HERE'.to_i
|
49
|
+
criterion_id = 'INSERT_CRITERION_ID_HERE'.to_i
|
50
|
+
|
51
|
+
# Prepare for adding experiment.
|
52
|
+
operation = {
|
53
|
+
:operator => 'ADD',
|
54
|
+
:operand => {
|
55
|
+
:campaign_id => campaign_id,
|
56
|
+
:name => "Interplanetary Experiment #%d" % (Time.new.to_f * 1000).to_i,
|
57
|
+
:query_percentage => 10,
|
58
|
+
:start_date_time => Time.now.strftime('%Y%m%d %H%M%S')
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
# Add experiment.
|
63
|
+
response = experiment_srv.mutate([operation])
|
64
|
+
experiment = response[:value].first
|
65
|
+
puts "Experiment with name '%s' and ID %d was added." %
|
66
|
+
[experiment[:name], experiment[:id]]
|
67
|
+
|
68
|
+
experiment_id = experiment[:id]
|
69
|
+
|
70
|
+
# Setup ad group for the experiment.
|
71
|
+
ad_group = {
|
72
|
+
:id => ad_group_id,
|
73
|
+
# Set experiment data for the ad group.
|
74
|
+
:experiment_data => {
|
75
|
+
:experiment_id => experiment_id,
|
76
|
+
:experiment_delta_status => 'MODIFIED',
|
77
|
+
# Bid multiplier rule that will modify ad group bid for the experiment.
|
78
|
+
:experiment_bid_multipliers => {
|
79
|
+
:xsi_type => 'ManualCPCAdGroupExperimentBidMultipliers',
|
80
|
+
:max_cpc_multiplier => {
|
81
|
+
:multiplier => 1.5
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
# Prepare for updating ad group.
|
88
|
+
operation = {
|
89
|
+
:operator => 'SET',
|
90
|
+
:operand => ad_group
|
91
|
+
}
|
92
|
+
|
93
|
+
# Update ad group.
|
94
|
+
response = ad_group_srv.mutate([operation])
|
95
|
+
ad_group = response[:value].first
|
96
|
+
puts "Ad group ID %d was updated for the experiment." % ad_group[:id]
|
97
|
+
|
98
|
+
# Setup ad group criterion for the experiment.
|
99
|
+
ad_group_criterion = {
|
100
|
+
:xsi_type => 'BiddableAdGroupCriterion',
|
101
|
+
:ad_group_id => ad_group_id,
|
102
|
+
:criterion => {
|
103
|
+
:id => criterion_id
|
104
|
+
},
|
105
|
+
# Set experiment data for the criterion.
|
106
|
+
:experiment_data => {
|
107
|
+
:xsi_type => 'BiddableAdGroupCriterionExperimentData',
|
108
|
+
:experiment_id => experiment_id,
|
109
|
+
:experiment_delta_status => 'MODIFIED',
|
110
|
+
# Bid multiplier rule that will modify criterion bid for the experiment.
|
111
|
+
:experiment_bid_multiplier => {
|
112
|
+
:xsi_type => 'ManualCPCAdGroupCriterionExperimentBidMultiplier',
|
113
|
+
:max_cpc_multiplier => {
|
114
|
+
:multiplier => 1.5
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
# Prepare for updating ad group criterion.
|
121
|
+
operation = {
|
122
|
+
:operator => 'SET',
|
123
|
+
:operand => ad_group_criterion
|
124
|
+
}
|
125
|
+
|
126
|
+
# Update criterion.
|
127
|
+
response = ad_group_criterion_srv.mutate([operation])
|
128
|
+
criterion = response[:value].first
|
129
|
+
puts "Criterion ID %d was successfully updated for the experiment." %
|
130
|
+
[criterion[:criterion][:id]]
|
131
|
+
|
132
|
+
end
|
133
|
+
|
134
|
+
if __FILE__ == $0
|
135
|
+
begin
|
136
|
+
add_experiment()
|
137
|
+
|
138
|
+
# HTTP errors.
|
139
|
+
rescue AdsCommon::Errors::HttpError => e
|
140
|
+
puts "HTTP Error: %s" % e
|
141
|
+
|
142
|
+
# API errors.
|
143
|
+
rescue AdwordsApi::Errors::ApiException => e
|
144
|
+
puts "Message: %s" % e.message
|
145
|
+
puts 'Errors:'
|
146
|
+
e.errors.each_with_index do |error, index|
|
147
|
+
puts "\tError [%d]:" % (index + 1)
|
148
|
+
error.each do |field, value|
|
149
|
+
puts "\t\t%s: %s" % [field, value]
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
|
+
#
|
7
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
+
# implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
# This example illustrates how to create a negative campaign criterion for a
|
21
|
+
# given campaign. To create a campaign, run add_campaign.rb.
|
22
|
+
#
|
23
|
+
# Tags: CampaignCriterionService.mutate
|
24
|
+
|
25
|
+
require 'rubygems'
|
26
|
+
require 'adwords_api'
|
27
|
+
|
28
|
+
API_VERSION = :v201109
|
29
|
+
|
30
|
+
def add_negative_campaign_criterion()
|
31
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
32
|
+
# when called without parameters.
|
33
|
+
adwords = AdwordsApi::Api.new
|
34
|
+
|
35
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
36
|
+
# the configuration file or provide your own logger:
|
37
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
38
|
+
|
39
|
+
campaign_criterion_srv =
|
40
|
+
adwords.service(:CampaignCriterionService, API_VERSION)
|
41
|
+
|
42
|
+
campaign_id = 'INSERT_CAMPAIGN_ID_HERE'.to_i
|
43
|
+
|
44
|
+
# Prepare for adding criterion.
|
45
|
+
operation = {
|
46
|
+
:operator => 'ADD',
|
47
|
+
:operand => {
|
48
|
+
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
49
|
+
# being created. It's only necessary when you must provide an explicit
|
50
|
+
# type that the client library can't infer.
|
51
|
+
:xsi_type => 'NegativeCampaignCriterion',
|
52
|
+
:campaign_id => campaign_id,
|
53
|
+
:criterion => {
|
54
|
+
:xsi_type => 'Keyword',
|
55
|
+
:text => 'jupiter cruise',
|
56
|
+
:match_type => 'BROAD'
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
# Add criterion.
|
62
|
+
response = campaign_criterion_srv.mutate([operation])
|
63
|
+
campaign_criterion = response[:value].first
|
64
|
+
puts 'Campaign criterion id %d was successfully added.' %
|
65
|
+
campaign_criterion[:criterion][:id]
|
66
|
+
end
|
67
|
+
|
68
|
+
if __FILE__ == $0
|
69
|
+
begin
|
70
|
+
add_negative_campaign_criterion()
|
71
|
+
|
72
|
+
# HTTP errors.
|
73
|
+
rescue AdsCommon::Errors::HttpError => e
|
74
|
+
puts "HTTP Error: %s" % e
|
75
|
+
|
76
|
+
# API errors.
|
77
|
+
rescue AdwordsApi::Errors::ApiException => e
|
78
|
+
puts "Message: %s" % e.message
|
79
|
+
puts 'Errors:'
|
80
|
+
e.errors.each_with_index do |error, index|
|
81
|
+
puts "\tError [%d]:" % (index + 1)
|
82
|
+
error.each do |field, value|
|
83
|
+
puts "\t\t%s: %s" % [field, value]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#
|
3
|
+
# Author:: api.sgomes@gmail.com (Sérgio Gomes)
|
4
|
+
#
|
5
|
+
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
|
6
|
+
#
|
7
|
+
# License:: Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
16
|
+
# implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
# This example illustrates how to create a user list and show its associated
|
21
|
+
# conversion tracker code snippet.
|
22
|
+
#
|
23
|
+
# Tags: UserListService.mutate, ConversionTrackerService.get
|
24
|
+
|
25
|
+
require 'rubygems'
|
26
|
+
require 'adwords_api'
|
27
|
+
|
28
|
+
API_VERSION = :v201109
|
29
|
+
|
30
|
+
def add_user_list()
|
31
|
+
# AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
|
32
|
+
# when called without parameters.
|
33
|
+
adwords = AdwordsApi::Api.new
|
34
|
+
|
35
|
+
# To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
|
36
|
+
# the configuration file or provide your own logger:
|
37
|
+
# adwords.logger = Logger.new('adwords_xml.log')
|
38
|
+
|
39
|
+
user_list_srv = adwords.service(:UserListService, API_VERSION)
|
40
|
+
conv_tracker_srv = adwords.service(:ConversionTrackerService, API_VERSION)
|
41
|
+
|
42
|
+
# Prepare for adding remarketing user list.
|
43
|
+
name = "Mars cruise customers #%d" % (Time.new.to_f * 1000).to_i
|
44
|
+
operation = {
|
45
|
+
:operator => 'ADD',
|
46
|
+
:operand => {
|
47
|
+
# The 'xsi_type' field allows you to specify the xsi:type of the object
|
48
|
+
# being created. It's only necessary when you must provide an explicit
|
49
|
+
# type that the client library can't infer.
|
50
|
+
:xsi_type => 'RemarketingUserList',
|
51
|
+
:name => name,
|
52
|
+
:description => 'A list of mars cruise customers in the last year',
|
53
|
+
:status => 'OPEN',
|
54
|
+
:membership_life_span => 365,
|
55
|
+
:conversion_types => [{:name => name}]
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
# Add user list.
|
60
|
+
response = user_list_srv.mutate([operation])
|
61
|
+
if response and response[:value]
|
62
|
+
user_list = response[:value].first
|
63
|
+
|
64
|
+
# Get conversion snippets.
|
65
|
+
if user_list and user_list[:conversion_types]
|
66
|
+
conversion_ids = user_list[:conversion_types].map {|type| type[:id]}
|
67
|
+
selector = {
|
68
|
+
# We're actually interested in the 'Snippet' field, which is returned
|
69
|
+
# automatically.
|
70
|
+
:fields => ['Id'],
|
71
|
+
:predicates => [
|
72
|
+
{:field => 'Id', :operator => 'IN', :values => conversion_ids}
|
73
|
+
]
|
74
|
+
}
|
75
|
+
conv_tracker_response = conv_tracker_srv.get(selector)
|
76
|
+
if conv_tracker_response and conv_tracker_response[:entries]
|
77
|
+
conversions = conv_tracker_response[:entries]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
puts "User list with name '%s' and ID %d was added." %
|
81
|
+
[user_list[:name], user_list[:id]]
|
82
|
+
# Display user list associated conversion code snippets.
|
83
|
+
if conversions
|
84
|
+
conversions.each do |conversion|
|
85
|
+
puts "Conversion type code snipped associated to the list:\n\t\t%s\n" %
|
86
|
+
conversion[:snippet]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
else
|
90
|
+
puts 'No user lists were added.'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
if __FILE__ == $0
|
95
|
+
begin
|
96
|
+
add_user_list()
|
97
|
+
|
98
|
+
# HTTP errors.
|
99
|
+
rescue AdsCommon::Errors::HttpError => e
|
100
|
+
puts "HTTP Error: %s" % e
|
101
|
+
|
102
|
+
# API errors.
|
103
|
+
rescue AdwordsApi::Errors::ApiException => e
|
104
|
+
puts "Message: %s" % e.message
|
105
|
+
puts 'Errors:'
|
106
|
+
e.errors.each_with_index do |error, index|
|
107
|
+
puts "\tError [%d]:" % (index + 1)
|
108
|
+
error.each do |field, value|
|
109
|
+
puts "\t\t%s: %s" % [field, value]
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|