Bing Ads
This page contains the setup guide and reference information for the Bing Ads source connector.
Setup guide
Step 1: Set up Bing Ads
- Register your application in the Azure portal.
- Request user consent to get the authorization code.
- Use the authorization code to get a refresh token.
The refresh token expires in 90 days. Repeat the authorization process to get a new refresh token. The full authentication process described here. Please be sure to authenticate with the email (personal or work) that you used to sign in to the Bing ads/Microsoft ads platform.
- Get your Microsoft developer token.
- If your OAuth app has a custom tenant and you cannot use Microsoft’s recommended common tenant, use the custom tenant in the Tenant ID field when you set up the connector.
The tenant is used in the authentication URL, for example: https://login.microsoftonline.com/<tenant>/oauth2/v2.0/authorize
Step 2: Set up the source connector in Airbyte
For Airbyte Cloud:
- Log in to your Airbyte Cloud account.
- Click Sources and then click + New source.
- On the Set up the source page, select Bing Ads from the Source type dropdown.
- Enter a name for your source.
- For Tenant ID, enter the custom tenant or use the common tenant.
- Add the developer token from Step 1.
- For Replication Start Date, enter the date in YYYY-MM-DD format. The data added on and after this date will be replicated. If this field is blank, Airbyte will replicate all data.
- For Lookback window (also known as attribution or conversion window) enter the number of days to look into the past. If your conversion window has an hours/minutes granularity, round it up to the number of days exceeding. If you're not using performance report streams in incremental mode, let it with 0 default value.
- Click Authenticate your Bing Ads account.
- Log in and authorize the Bing Ads account.
- Click Set up source.
For Airbyte Open Source:
- Log in to your Airbyte Open Source account.
- Click Sources and then click + New source.
- On the Set up the source page, select Bing Ads from the Source type dropdown.
- Enter a name for your source.
- For Tenant ID, enter the custom tenant or use the common tenant.
- Enter the Client ID, Client Secret, Refresh Token, and Developer Token from Step 1.
- For Replication Start Date, enter the date in YYYY-MM-DD format. The data added on and after this date will be replicated. If this field is blank, Airbyte will replicate all data.
- For Lookback window (also known as attribution or conversion window) enter the number of days to look into the past. If your conversion window has an hours/minutes granularity, round it up to the number of days exceeding. If you're not using performance report streams in incremental mode, let it with 0 default value.
- Click Set up source.
Supported sync modes
The Bing Ads source connector supports the following sync modes:
Supported Streams
The Bing Ads source connector supports the following streams. For more information, see the Bing Ads API.
Basic streams
Report Streams
- account_performance_report_hourly
- account_performance_report_daily
- account_performance_report_weekly
- account_performance_report_monthly
- ad_group_performance_report_hourly
- ad_group_performance_report_daily
- ad_group_performance_report_weekly
- ad_group_performance_report_monthly
- ad_performance_report_hourly
- ad_performance_report_daily
- ad_performance_report_weekly
- ad_performance_report_monthly
- geographic_performance_report_hourly
- geographic_performance_report_daily
- geographic_performance_report_weekly
- geographic_performance_report_monthly
- budget_summary_report
- campaign_performance_report_hourly
- campaign_performance_report_daily
- campaign_performance_report_weekly
- campaign_performance_report_monthly
- keyword_performance_report_hourly
- keyword_performance_report_daily
- keyword_performance_report_weekly
- keyword_performance_report_monthly
Report aggregation
All reports synced by this connector can be aggregated using hourly, daily, weekly, or monthly time windows.
For example, if you select a report with daily aggregation, the report will contain a row for each day for the duration of the report. Each row will indicate the number of impressions recorded on that day.
A report's aggregation window is indicated in its name. For example, account_performance_report_hourly
is the Account Performance Reported aggregated using an hourly window.
Performance considerations
The Bing Ads API limits the number of requests for all Microsoft Advertising clients. You can find detailed info here.
Build instructions
Build your own connector image
This connector is built using our dynamic built process.
The base image used to build it is defined within the metadata.yaml file under the connectorBuildOptions
.
The build logic is defined using Dagger here.
It does not rely on a Dockerfile.
If you would like to patch our connector and build your own a simple approach would be:
- Create your own Dockerfile based on the latest version of the connector image.
FROM airbyte/source-bing-ads:latest
COPY . ./airbyte/integration_code
RUN pip install ./airbyte/integration_code
# The entrypoint and default env vars are already set in the base image
# ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
# ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
Please use this as an example. This is not optimized.
- Build your image:
docker build -t airbyte/source-bing-ads:dev .
# Running the spec command against your patched connector
docker run airbyte/source-bing-ads:dev spec
Customizing our build process
When contributing on our connector you might need to customize the build process to add a system dependency or set an env var.
You can customize our build process by adding a build_customization.py
module to your connector.
This module should contain a pre_connector_install
and post_connector_install
async function that will mutate the base image and the connector container respectively.
It will be imported at runtime by our build process and the functions will be called if they exist.
Here is an example of a build_customization.py
module:
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
# Feel free to check the dagger documentation for more information on the Container object and its methods.
# https://dagger-io.readthedocs.io/en/sdk-python-v0.6.4/
from dagger import Container
async def pre_connector_install(base_image_container: Container) -> Container:
return await base_image_container.with_env_variable("MY_PRE_BUILD_ENV_VAR", "my_pre_build_env_var_value")
async def post_connector_install(connector_container: Container) -> Container:
return await connector_container.with_env_variable("MY_POST_BUILD_ENV_VAR", "my_post_build_env_var_value")
Changelog
Version | Date | Pull Request | Subject |
---|---|---|---|
1.0.1 | 2023-10-13 | 31377 | Use our base image and remove Dockerfile |
1.0.0 | 2023-10-11 | 31277 | Remove primary keys from the geographic performance reports. |
0.2.3 | 2023-09-28 | 30834 | Wrap auth error with the config error. |
0.2.2 | 2023-09-27 | 30791 | Fix missing fields for geographic performance reports. |
0.2.1 | 2023-09-04 | 30128 | Add increasing download timeout if ReportingDownloadException occurs |
0.2.0 | 2023-08-17 | 27619 | Add Geographic Performance Report |
0.1.24 | 2023-06-22 | 27619 | Retry request after facing temporary name resolution error. |
0.1.23 | 2023-05-11 | 25996 | Implement a retry logic if SSL certificate validation fails. |
0.1.22 | 2023-05-08 | 24223 | Add CampaignLabels report column in campaign performance report |
0.1.21 | 2023-04-28 | 25668 | Add undeclared fields to accounts, campaigns, campaign_performance_report, keyword_performance_report and account_performance_report streams |
0.1.20 | 2023-03-09 | 23663 | Add lookback window for performance reports in incremental mode |
0.1.19 | 2023-03-08 | 23868 | Add dimensional-type columns for reports. |
0.1.18 | 2023-01-30 | 22073 | Fix null values in the Keyword column of keyword_performance_report streams |
0.1.17 | 2022-12-10 | 20005 | Add Keyword to keyword_performance_report stream |
0.1.16 | 2022-10-12 | 17873 | Fix: added missing campaign types in (Audience, Shopping and DynamicSearchAds) in campaigns stream |
0.1.15 | 2022-10-03 | 17505 | Fix: limit cache size for ServiceClient instances |
0.1.14 | 2022-09-29 | 17403 | Fix: limit cache size for ReportingServiceManager instances |
0.1.13 | 2022-09-29 | 17386 | Migrate to per-stream states. |
0.1.12 | 2022-09-05 | 16335 | Added backoff for socket.timeout |
0.1.11 | 2022-08-25 | 15684 (published in 15987) | Fixed log messages being unreadable |
0.1.10 | 2022-08-12 | 15602 | Fixed bug caused Hourly Reports to crash due to invalid fields set |
0.1.9 | 2022-08-02 | 14862 | Added missing columns |
0.1.8 | 2022-06-15 | 13801 | All reports hourly/daily/weekly/monthly will be generated by default, these options are removed from input configuration |
0.1.7 | 2022-05-17 | 12937 | Added OAuth2.0 authentication method, removed redirect_uri from input configuration |
0.1.6 | 2022-04-30 | 12500 | Improve input configuration copy |
0.1.5 | 2022-01-01 | 11652 | Rebump attempt after DockerHub failure at registring the 0.1.4 |
0.1.4 | 2022-03-22 | 11311 | Added optional Redirect URI & Tenant ID to spec |
0.1.3 | 2022-01-14 | 9510 | Fixed broken dependency that blocked connector's operations |
0.1.2 | 2021-12-14 | 8429 | Update titles and descriptions |
0.1.1 | 2021-08-31 | 5750 | Added reporting streams) |
0.1.0 | 2021-07-22 | 4911 | Initial release supported core streams (Accounts, Campaigns, Ads, AdGroups) |