How do you link location extensions to specific campaigns or ad groups?

Started by oj6201tp6s, Jun 23, 2024, 09:11 AM

Previous topic - Next topic

oj6201tp6s

 How do you link location extensions to specific campaigns or ad groups?

0751bez

Linking location extensions to specific campaigns or ad groups in Bing Ads (Microsoft Advertising) involves using the Campaign Management API to associate your location extensions with the appropriate campaigns or ad groups. Here's a step-by-step guide on how to do this:

### **1. **Create or Identify Location Extensions***

   Before linking location extensions to campaigns or ad groups, ensure you have created the location extensions. You'll need the ID of each location extension you want to link.

   **Creating Location Extensions Example:**

   ```csharp
   // Example of creating a location extension
   LocationExtension locationExtension = new LocationExtension
   {
       BusinessName = "Your Business Name",
       Address = new Address
       {
           StreetAddress = "123 Main St",
           CityName = "City",
           StateOrProvince = "State",
           PostalCode = "12345",
           CountryCode = "US"
       },
       PhoneNumber = "+1-234-567-8900",
       // Additional properties
   };

   // Add the location extension using the API (assuming you've set up your API client)
   var locationExtensionService = new LocationExtensionServiceClient();
   var addRequest = new AddLocationExtensionsRequest
   {
       LocationExtensions = new[] { locationExtension },
       // Additional settings
   };
   var addResponse = locationExtensionService.AddLocationExtensions(addRequest);
   ```

### **2. **Link Location Extensions to Campaigns or Ad Groups**

   You can link location extensions to specific campaigns or ad groups using the Campaign Management API. This involves creating `CampaignExtensionSetting` or `AdGroupExtensionSetting` objects and associating them with your location extensions.

   **Linking Location Extensions to Campaigns Example:**

   ```csharp
   // Create a CampaignExtensionSetting to link location extensions to a campaign
   CampaignExtensionSetting campaignExtensionSetting = new CampaignExtensionSetting
   {
       CampaignId = yourCampaignId, // Replace with your campaign ID
       ExtensionSetting = new ExtensionSetting
       {
           Extensions = new[] { locationExtensionId } // Replace with your location extension ID
       }
   };

   // Create the Campaign Management API client
   var campaignManagementService = new CampaignManagementServiceClient();

   // Add the CampaignExtensionSetting
   var addCampaignExtensionSettingsRequest = new AddCampaignExtensionSettingsRequest
   {
       CampaignExtensionSettings = new[] { campaignExtensionSetting },
       // Additional settings if needed
   };
   var addCampaignExtensionSettingsResponse = campaignManagementService.AddCampaignExtensionSettings(addCampaignExtensionSettingsRequest);
   ```

   **Linking Location Extensions to Ad Groups Example:**

   ```csharp
   // Create an AdGroupExtensionSetting to link location extensions to an ad group
   AdGroupExtensionSetting adGroupExtensionSetting = new AdGroupExtensionSetting
   {
       AdGroupId = yourAdGroupId, // Replace with your ad group ID
       ExtensionSetting = new ExtensionSetting
       {
           Extensions = new[] { locationExtensionId } // Replace with your location extension ID
       }
   };

   // Add the AdGroupExtensionSetting
   var addAdGroupExtensionSettingsRequest = new AddAdGroupExtensionSettingsRequest
   {
       AdGroupExtensionSettings = new[] { adGroupExtensionSetting },
       // Additional settings if needed
   };
   var addAdGroupExtensionSettingsResponse = campaignManagementService.AddAdGroupExtensionSettings(addAdGroupExtensionSettingsRequest);
   ```

### **3. **Verify and Monitor the Setup***

   - **Check Associations:** Use the API to verify that the location extensions have been successfully linked to the desired campaigns or ad groups. You can do this by retrieving the settings and confirming the associations.

   **Retrieving Extension Settings Example:**

   ```csharp
   // Retrieve Campaign Extension Settings
   var getCampaignExtensionSettingsRequest = new GetCampaignExtensionSettingsByIdsRequest
   {
       CampaignExtensionSettingIds = new[] { yourCampaignExtensionSettingId }
   };
   var getCampaignExtensionSettingsResponse = campaignManagementService.GetCampaignExtensionSettingsByIds(getCampaignExtensionSettingsRequest);

   // Retrieve Ad Group Extension Settings
   var getAdGroupExtensionSettingsRequest = new GetAdGroupExtensionSettingsByIdsRequest
   {
       AdGroupExtensionSettingIds = new[] { yourAdGroupExtensionSettingId }
   };
   var getAdGroupExtensionSettingsResponse = campaignManagementService.GetAdGroupExtensionSettingsByIds(getAdGroupExtensionSettingsRequest);
   ```

   - **Monitor Performance:** Track the performance of your location extensions in the campaigns or ad groups to ensure they are performing as expected. Use metrics such as click-through rate (CTR), conversion rate, and engagement to evaluate their effectiveness.

### **4. **Adjust and Optimize***

   - **Make Adjustments:** Based on performance data, you may need to adjust your location extensions or their associations. This could involve changing the linked campaigns or ad groups or updating the location extension details.

   **Updating Location Extensions Example:**

   ```csharp
   // Example of updating a location extension
   LocationExtension updatedLocationExtension = new LocationExtension
   {
       Id = locationExtensionId, // Replace with your location extension ID
       BusinessName = "Updated Business Name",
       // Other updated properties
   };

   var updateRequest = new UpdateLocationExtensionsRequest
   {
       LocationExtensions = new[] { updatedLocationExtension }
   };
   var updateResponse = locationExtensionService.UpdateLocationExtensions(updateRequest);
   ```

By following these steps, you can effectively link location extensions to specific campaigns or ad groups using the Microsoft Advertising API, ensuring that your ads are more relevant and engaging to users searching for businesses in particular locations.

Didn't find what you were looking for? Search Below