google_ads_create_app_campaign
Create a Universal App Campaign to promote mobile app installs and engagement. Automatically optimizes ad creative and placement across Google Search, Display, YouTube, and Google Play.
Instructions
Create a Universal App Campaign (UAC) to promote mobile app installs and engagement.
App campaigns automatically optimize ad creative and placement across Google Search, Display Network, YouTube, and Google Play to drive app installs and in-app actions.
Args: customer_id: Google Ads customer ID (10 digits, no hyphens) campaign_name: Name for the app campaign app_id: App store identifier (bundle ID for iOS, package name for Android) app_store: "APPLE_APP_STORE" or "GOOGLE_APP_STORE" budget_amount: Daily budget in account currency bidding_strategy_goal_type: Bidding goal - one of: - OPTIMIZE_INSTALLS_TARGET_INSTALL_COST (target CPA for installs) - OPTIMIZE_IN_APP_CONVERSIONS_TARGET_INSTALL_COST (target CPA for installs + conversions) - OPTIMIZE_IN_APP_CONVERSIONS_TARGET_CONVERSION_COST (target CPA for conversions) - OPTIMIZE_RETURN_ON_ADVERTISING_SPEND (target ROAS) - OPTIMIZE_PRE_REGISTRATION_CONVERSION_VOLUME (pre-registration campaigns) target_cpa: Optional target cost per action (for CPA-based strategies)
Returns: Dictionary with campaign creation results including: - campaign_id: Created campaign ID - campaign_name: Campaign name - resource_name: Full resource name - app_id: App store identifier - app_store: App store type - budget: Daily budget amount - bidding_goal: Selected bidding strategy goal
Example:
Create an iOS app campaign optimizing for installs:
google_ads_create_app_campaign(
customer_id="1234567890",
campaign_name="iOS App Install Campaign",
app_id="com.example.myapp",
app_store="APPLE_APP_STORE",
budget_amount=100.0,
bidding_strategy_goal_type="OPTIMIZE_INSTALLS_TARGET_INSTALL_COST",
target_cpa=5.0
)
Notes: - Campaigns start in PAUSED status - Requires app store listing to be live - Automatic ad creation from app store assets - Can add text, image, video, and HTML5 assets for better performance
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| customer_id | Yes | ||
| campaign_name | Yes | ||
| app_id | Yes | ||
| app_store | Yes | ||
| budget_amount | Yes | ||
| bidding_strategy_goal_type | Yes | ||
| target_cpa | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- The main MCP tool handler function that creates an app campaign. Validates inputs (customer_id, budget, app_store, bidding_strategy, target_cpa), constructs an AppCampaignConfig, calls LocalAppManager.create_app_campaign(), logs the audit trail, and returns a formatted response.
async def google_ads_create_app_campaign( customer_id: str, campaign_name: str, app_id: str, app_store: str, budget_amount: float, bidding_strategy_goal_type: str, target_cpa: Optional[float] = None ) -> Dict[str, Any]: """Create a Universal App Campaign (UAC) to promote mobile app installs and engagement. App campaigns automatically optimize ad creative and placement across Google Search, Display Network, YouTube, and Google Play to drive app installs and in-app actions. Args: customer_id: Google Ads customer ID (10 digits, no hyphens) campaign_name: Name for the app campaign app_id: App store identifier (bundle ID for iOS, package name for Android) app_store: "APPLE_APP_STORE" or "GOOGLE_APP_STORE" budget_amount: Daily budget in account currency bidding_strategy_goal_type: Bidding goal - one of: - OPTIMIZE_INSTALLS_TARGET_INSTALL_COST (target CPA for installs) - OPTIMIZE_IN_APP_CONVERSIONS_TARGET_INSTALL_COST (target CPA for installs + conversions) - OPTIMIZE_IN_APP_CONVERSIONS_TARGET_CONVERSION_COST (target CPA for conversions) - OPTIMIZE_RETURN_ON_ADVERTISING_SPEND (target ROAS) - OPTIMIZE_PRE_REGISTRATION_CONVERSION_VOLUME (pre-registration campaigns) target_cpa: Optional target cost per action (for CPA-based strategies) Returns: Dictionary with campaign creation results including: - campaign_id: Created campaign ID - campaign_name: Campaign name - resource_name: Full resource name - app_id: App store identifier - app_store: App store type - budget: Daily budget amount - bidding_goal: Selected bidding strategy goal Example: Create an iOS app campaign optimizing for installs: ``` google_ads_create_app_campaign( customer_id="1234567890", campaign_name="iOS App Install Campaign", app_id="com.example.myapp", app_store="APPLE_APP_STORE", budget_amount=100.0, bidding_strategy_goal_type="OPTIMIZE_INSTALLS_TARGET_INSTALL_COST", target_cpa=5.0 ) ``` Notes: - Campaigns start in PAUSED status - Requires app store listing to be live - Automatic ad creation from app store assets - Can add text, image, video, and HTML5 assets for better performance """ try: with performance_logger.track_operation("create_app_campaign"): # Get client and initialize manager client = get_auth_manager().get_client() local_app_manager = LocalAppManager(client) # Validate customer ID customer_id = customer_id.replace('-', '') if not customer_id.isdigit() or len(customer_id) != 10: raise ValueError("Customer ID must be 10 digits") # Validate budget if budget_amount <= 0: raise ValueError("Budget amount must be positive") # Validate app store try: app_store_enum = AppCampaignAppStore(app_store) except ValueError: raise ValueError(f"Invalid app store. Must be: APPLE_APP_STORE or GOOGLE_APP_STORE") # Validate bidding strategy try: bidding_goal_enum = AppCampaignBiddingStrategyGoalType(bidding_strategy_goal_type) except ValueError: valid_goals = [goal.value for goal in AppCampaignBiddingStrategyGoalType] raise ValueError(f"Invalid bidding goal. Must be one of: {', '.join(valid_goals)}") # Validate target CPA if provided if target_cpa is not None and target_cpa <= 0: raise ValueError("Target CPA must be positive") # Create configuration config = AppCampaignConfig( name=campaign_name, app_id=app_id, app_store=app_store_enum, budget_amount=budget_amount, bidding_strategy_goal_type=bidding_goal_enum, target_cpa=target_cpa ) # Create campaign result = local_app_manager.create_app_campaign( customer_id=customer_id, config=config ) # Log audit trail audit_logger.log_api_call( operation="create_app_campaign", customer_id=customer_id, details={ 'campaign_name': campaign_name, 'app_id': app_id, 'app_store': app_store, 'budget': budget_amount, 'bidding_goal': bidding_strategy_goal_type, 'target_cpa': target_cpa }, response=result ) # Format response response = f""" ## App Campaign Created Successfully **Campaign Details:** - Campaign ID: `{result['campaign_id']}` - Campaign Name: {result['campaign_name']} - Resource Name: `{result['resource_name']}` **App Configuration:** - App ID: {result['app_id']} - App Store: {result['app_store']} **Budget & Bidding:** - Daily Budget: ${result['budget']:.2f} - Bidding Goal: {result['bidding_goal']} {f"- Target CPA: ${target_cpa:.2f}" if target_cpa else "- Bidding: Maximize Conversions (no target)"} **Status:** Campaign created in PAUSED status **Next Steps:** 1. Add text assets (up to 5 headlines, 5 descriptions) 2. Add image assets (recommended: 1200x628, 1200x1200, 320x50) 3. Add video assets (YouTube videos) 4. Add HTML5 assets if available 5. Enable the campaign when ready to start **Optimization:** App campaigns automatically optimize ad placement across: - Google Search - Google Display Network - YouTube - Google Play - Google Discover The campaign will use machine learning to find the best audiences and creatives for your app promotion goals. """ return { "content": [{"type": "text", "text": response.strip()}], "metadata": result } except Exception as e: error_msg = ErrorHandler.handle_error(e, { 'operation': 'create_app_campaign', 'customer_id': customer_id, 'campaign_name': campaign_name }) return {"content": [{"type": "text", "text": error_msg}], "isError": True} - managers/local_app_manager.py:49-57 (schema)Dataclass defining the AppCampaignConfig schema used for app campaign creation, including name, app_id, app_store, budget_amount, bidding_strategy_goal_type, and optional target_cpa.
@dataclass class AppCampaignConfig: """Configuration for app campaign creation.""" name: str app_id: str # App store ID app_store: AppCampaignAppStore budget_amount: float bidding_strategy_goal_type: AppCampaignBiddingStrategyGoalType target_cpa: Optional[float] = None - managers/local_app_manager.py:25-28 (schema)Enum schema for AppCampaignAppStore values (APPLE_APP_STORE, GOOGLE_APP_STORE).
class AppCampaignAppStore(str, Enum): """App store types.""" APPLE_APP_STORE = "APPLE_APP_STORE" GOOGLE_APP_STORE = "GOOGLE_APP_STORE" - managers/local_app_manager.py:31-37 (schema)Enum schema for AppCampaignBiddingStrategyGoalType values defining the available bidding goals.
class AppCampaignBiddingStrategyGoalType(str, Enum): """App campaign bidding goals.""" OPTIMIZE_INSTALLS_TARGET_INSTALL_COST = "OPTIMIZE_INSTALLS_TARGET_INSTALL_COST" OPTIMIZE_IN_APP_CONVERSIONS_TARGET_INSTALL_COST = "OPTIMIZE_IN_APP_CONVERSIONS_TARGET_INSTALL_COST" OPTIMIZE_IN_APP_CONVERSIONS_TARGET_CONVERSION_COST = "OPTIMIZE_IN_APP_CONVERSIONS_TARGET_CONVERSION_COST" OPTIMIZE_RETURN_ON_ADVERTISING_SPEND = "OPTIMIZE_RETURN_ON_ADVERTISING_SPEND" OPTIMIZE_PRE_REGISTRATION_CONVERSION_VOLUME = "OPTIMIZE_PRE_REGISTRATION_CONVERSION_VOLUME" - The LocalAppManager.create_app_campaign() method that constructs and executes the Google Ads API calls to create the campaign budget and campaign with app campaign settings.
def create_app_campaign( self, customer_id: str, config: AppCampaignConfig ) -> Dict[str, Any]: """Create an App campaign (Universal App Campaign). Args: customer_id: Customer ID (without hyphens) config: App campaign configuration Returns: Created campaign details """ campaign_service = self.client.get_service("CampaignService") campaign_budget_service = self.client.get_service("CampaignBudgetService") # Create campaign budget budget_operation = self.client.get_type("CampaignBudgetOperation") budget = budget_operation.create budget.name = f"{config.name} Budget" budget.amount_micros = int(config.budget_amount * 1_000_000) budget.delivery_method = self.client.enums.BudgetDeliveryMethodEnum.STANDARD budget_response = campaign_budget_service.mutate_campaign_budgets( customer_id=customer_id, operations=[budget_operation] ) budget_resource_name = budget_response.results[0].resource_name # Create app campaign campaign_operation = self.client.get_type("CampaignOperation") campaign = campaign_operation.create campaign.name = config.name campaign.advertising_channel_type = self.client.enums.AdvertisingChannelTypeEnum.MULTI_CHANNEL campaign.advertising_channel_sub_type = self.client.enums.AdvertisingChannelSubTypeEnum.APP_CAMPAIGN campaign.status = self.client.enums.CampaignStatusEnum.PAUSED campaign.campaign_budget = budget_resource_name # App campaign settings campaign.app_campaign_setting.app_id = config.app_id campaign.app_campaign_setting.app_store = self.client.enums.AppCampaignAppStoreEnum[ config.app_store.value ] campaign.app_campaign_setting.bidding_strategy_goal_type = ( self.client.enums.AppCampaignBiddingStrategyGoalTypeEnum[ config.bidding_strategy_goal_type.value ] ) # Set bidding strategy based on goal type if config.bidding_strategy_goal_type.value.startswith("OPTIMIZE_INSTALLS"): if config.target_cpa: campaign.target_cpa.target_cpa_micros = int(config.target_cpa * 1_000_000) else: campaign.maximize_conversions.CopyFrom(self.client.get_type("MaximizeConversions")) elif "TARGET_CONVERSION_COST" in config.bidding_strategy_goal_type.value: if config.target_cpa: campaign.target_cpa.target_cpa_micros = int(config.target_cpa * 1_000_000) else: campaign.maximize_conversions.CopyFrom(self.client.get_type("MaximizeConversions")) elif config.bidding_strategy_goal_type.value == "OPTIMIZE_RETURN_ON_ADVERTISING_SPEND": campaign.maximize_conversion_value.CopyFrom(self.client.get_type("MaximizeConversionValue")) else: campaign.maximize_conversions.CopyFrom(self.client.get_type("MaximizeConversions")) # Create campaign response = campaign_service.mutate_campaigns( customer_id=customer_id, operations=[campaign_operation] ) campaign_id = response.results[0].resource_name.split('/')[-1] return { 'campaign_id': campaign_id, 'campaign_name': config.name, 'resource_name': response.results[0].resource_name, 'app_id': config.app_id, 'app_store': config.app_store.value, 'budget': config.budget_amount, 'bidding_goal': config.bidding_strategy_goal_type.value }