Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Source Bing Ads: add new stream UserLocationPerformanceReport #31837

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ acceptance_tests:
bypass_reason: "Empty report; hourly data fetched is limited to 180 days"
- name: search_query_performance_report_hourly
bypass_reason: "Empty report; hourly data fetched is limited to 180 days"
timeout_seconds: 1200
- name: user_location_performance_report_hourly
bypass_reason: "Empty report; hourly data fetched is limited to 180 days"
timeout_seconds: 3600
full_refresh:
tests:
- config_path: secrets/config.json
configured_catalog_path: integration_tests/configured_catalog.json
timeout_seconds: 1200
timeout_seconds: 3600
incremental:
tests:
bypass_reason: "SAT doesn't support complex nested states used in incremental report streams"
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,46 @@
"sync_mode": "incremental",
"cursor_field": ["TimePeriod"],
"destination_sync_mode": "append"
},
{
"stream": {
"name": "user_location_performance_report_daily",
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"]
},
"sync_mode": "incremental",
"cursor_field": ["TimePeriod"],
"destination_sync_mode": "append"
},
{
"stream": {
"name": "user_location_performance_report_hourly",
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"]
},
"sync_mode": "incremental",
"cursor_field": ["TimePeriod"],
"destination_sync_mode": "append"
},
{
"stream": {
"name": "user_location_performance_report_weekly",
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"]
},
"sync_mode": "incremental",
"cursor_field": ["TimePeriod"],
"destination_sync_mode": "append"
},
{
"stream": {
"name": "user_location_performance_report_monthly",
"json_schema": {},
"supported_sync_modes": ["incremental", "full_refresh"]
},
"sync_mode": "incremental",
"cursor_field": ["TimePeriod"],
"destination_sync_mode": "append"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
{"stream":"search_query_performance_report_daily","data":{"AccountName":"Daxtarity Inc.","AccountNumber":"F149GKV5","AccountId":180278106,"TimePeriod":"2021-07-27","CampaignName":"Test 2","CampaignId":413444833,"AdGroupName":"Airbyte","AdGroupId":1352400325389092,"AdId":84525295496190,"AdType":"Responsive search ad","DestinationUrl":null,"BidMatchType":"Broad","DeliveredMatchType":"Exact (close variant)","CampaignStatus":"Paused","AdStatus":"Active","Impressions":112,"Clicks":0,"Ctr":0.0,"AverageCpc":0.0,"Spend":0.0,"AveragePosition":0.0,"SearchQuery":"data integration tool","Keyword":"data integration tools","AdGroupCriterionId":null,"Conversions":0,"ConversionRate":null,"CostPerConversion":null,"Language":"English","KeywordId":84525593559629,"Network":"Syndicated search partners","TopVsOther":"Syndicated search partners - Top","DeviceType":"Smartphone","DeviceOS":"Android","Assists":0,"Revenue":0.0,"ReturnOnAdSpend":null,"CostPerAssist":null,"RevenuePerConversion":null,"RevenuePerAssist":null,"AccountStatus":"Active","AdGroupStatus":"Active","KeywordStatus":"Active","CampaignType":"Search & content","CustomerId":251186883,"CustomerName":"Daxtarity Inc.","AllConversions":0,"AllRevenue":0.0,"AllConversionRate":null,"AllCostPerConversion":null,"AllReturnOnAdSpend":null,"AllRevenuePerConversion":null,"Goal":null,"GoalType":null,"AbsoluteTopImpressionRatePercent":17.86,"TopImpressionRatePercent":100.0,"AverageCpm":0.0,"ConversionsQualified":0.0,"AllConversionsQualified":0.0},"emitted_at":1698172081512}
{"stream":"search_query_performance_report_weekly","data":{"AccountName":"Daxtarity Inc.","AccountNumber":"F149GKV5","AccountId":180278106,"TimePeriod":"2021-07-11","CampaignName":"Test 2","CampaignId":413444833,"AdGroupName":"Airbyte","AdGroupId":1352400325389092,"AdId":84525295496190,"AdType":"Responsive search ad","DestinationUrl":null,"BidMatchType":"Broad","DeliveredMatchType":"Exact (close variant)","CampaignStatus":"Paused","AdStatus":"Active","Impressions":1,"Clicks":0,"Ctr":0.0,"AverageCpc":0.0,"Spend":0.0,"AveragePosition":0.0,"SearchQuery":"data integration tool","Keyword":"data integration tools","AdGroupCriterionId":null,"Conversions":0,"ConversionRate":null,"CostPerConversion":null,"Language":"English","KeywordId":84525593559629,"Network":"Syndicated search partners","TopVsOther":"Syndicated search partners - Top","DeviceType":"Tablet","DeviceOS":"Android","Assists":0,"Revenue":0.0,"ReturnOnAdSpend":null,"CostPerAssist":null,"RevenuePerConversion":null,"RevenuePerAssist":null,"AccountStatus":"Active","AdGroupStatus":"Active","KeywordStatus":"Active","CampaignType":"Search & content","CustomerId":251186883,"CustomerName":"Daxtarity Inc.","AllConversions":0,"AllRevenue":0.0,"AllConversionRate":null,"AllCostPerConversion":null,"AllReturnOnAdSpend":null,"AllRevenuePerConversion":null,"Goal":null,"GoalType":null,"AbsoluteTopImpressionRatePercent":0.0,"TopImpressionRatePercent":100.0,"AverageCpm":0.0,"ConversionsQualified":0.0,"AllConversionsQualified":0.0},"emitted_at":1698172090980}
{"stream":"search_query_performance_report_monthly","data":{"AccountName":"Daxtarity Inc.","AccountNumber":"F149GKV5","AccountId":180278106,"TimePeriod":"2021-07-01","CampaignName":"Test 2","CampaignId":413444833,"AdGroupName":"Airbyte","AdGroupId":1352400325389092,"AdId":84525295496190,"AdType":"Responsive search ad","DestinationUrl":null,"BidMatchType":"Broad","DeliveredMatchType":"Broad","CampaignStatus":"Paused","AdStatus":"Active","Impressions":551,"Clicks":11,"Ctr":2.0,"AverageCpc":0.03,"Spend":0.33,"AveragePosition":0.0,"SearchQuery":"data management platform","Keyword":"data integration tools","AdGroupCriterionId":null,"Conversions":0,"ConversionRate":0.0,"CostPerConversion":null,"Language":"English","KeywordId":84525593559629,"Network":"Syndicated search partners","TopVsOther":"Syndicated search partners - Top","DeviceType":"Smartphone","DeviceOS":"Android","Assists":0,"Revenue":0.0,"ReturnOnAdSpend":0.0,"CostPerAssist":null,"RevenuePerConversion":null,"RevenuePerAssist":null,"AccountStatus":"Active","AdGroupStatus":"Active","KeywordStatus":"Active","CampaignType":"Search & content","CustomerId":251186883,"CustomerName":"Daxtarity Inc.","AllConversions":0,"AllRevenue":0.0,"AllConversionRate":0.0,"AllCostPerConversion":null,"AllReturnOnAdSpend":0.0,"AllRevenuePerConversion":null,"Goal":null,"GoalType":null,"AbsoluteTopImpressionRatePercent":5.99,"TopImpressionRatePercent":100.0,"AverageCpm":0.6,"ConversionsQualified":0.0,"AllConversionsQualified":0.0},"emitted_at":1698172100880}
{"stream":"user_location_performance_report_daily","data":{"AccountName":"Daxtarity Inc.","AccountNumber":"F149GKV5","AccountId":180278106,"TimePeriod":"2021-06-22","CampaignName":"Test 2","CampaignId":413444833,"AdGroupName":"Airbyte","AdGroupId":1352400325389092,"Country":"Philippines","State":null,"MetroArea":null,"CurrencyCode":"USD","AdDistribution":"Search","Impressions":2,"Clicks":2,"Ctr":100.0,"AverageCpc":0.02,"Spend":0.04,"AveragePosition":0.0,"ProximityTargetLocation":null,"Radius":0,"Language":"English","City":null,"QueryIntentCountry":"Philippines","QueryIntentState":null,"QueryIntentCity":null,"QueryIntentDMA":null,"BidMatchType":"Broad","DeliveredMatchType":"Broad","Network":"Bing and Yahoo! search","TopVsOther":"Bing and Yahoo! search - Top","DeviceType":"Smartphone","DeviceOS":"Android","Assists":0,"Conversions":0,"ConversionRate":0.0,"Revenue":0.0,"ReturnOnAdSpend":0.0,"CostPerConversion":null,"CostPerAssist":null,"RevenuePerConversion":null,"RevenuePerAssist":null,"County":null,"PostalCode":null,"QueryIntentCounty":null,"QueryIntentPostalCode":null,"LocationId":149,"QueryIntentLocationId":149,"AllConversions":0,"AllRevenue":0.0,"AllConversionRate":0.0,"AllCostPerConversion":null,"AllReturnOnAdSpend":0.0,"AllRevenuePerConversion":null,"ViewThroughConversions":0,"Goal":null,"GoalType":null,"AbsoluteTopImpressionRatePercent":50.0,"TopImpressionRatePercent":100.0,"AverageCpm":20.0,"ConversionsQualified":0.0,"AllConversionsQualified":0.0,"ViewThroughConversionsQualified":null,"Neighborhood":null,"QueryIntentNeighborhood":null,"ViewThroughRevenue":0.0,"CampaignType":"Search & content","AssetGroupId":null,"AssetGroupName":null},"emitted_at":1698264446467}
{"stream":"user_location_performance_report_weekly","data":{"AccountName":"Daxtarity Inc.","AccountNumber":"F149GKV5","AccountId":180278106,"TimePeriod":"2021-06-13","CampaignName":"Test 2","CampaignId":413444833,"AdGroupName":"Airbyte","AdGroupId":1352400325389092,"Country":"Indonesia","State":null,"MetroArea":null,"CurrencyCode":"USD","AdDistribution":"Search","Impressions":22,"Clicks":3,"Ctr":13.64,"AverageCpc":0.09,"Spend":0.26,"AveragePosition":0.0,"ProximityTargetLocation":null,"Radius":0,"Language":"Indonesian","City":null,"QueryIntentCountry":"Indonesia","QueryIntentState":null,"QueryIntentCity":null,"QueryIntentDMA":null,"BidMatchType":"Broad","DeliveredMatchType":"Broad","Network":"Bing and Yahoo! search","TopVsOther":"Bing and Yahoo! search - Top","DeviceType":"Computer","DeviceOS":"Windows","Assists":0,"Conversions":0,"ConversionRate":0.0,"Revenue":0.0,"ReturnOnAdSpend":0.0,"CostPerConversion":null,"CostPerAssist":null,"RevenuePerConversion":null,"RevenuePerAssist":null,"County":null,"PostalCode":null,"QueryIntentCounty":null,"QueryIntentPostalCode":null,"LocationId":91,"QueryIntentLocationId":91,"AllConversions":0,"AllRevenue":0.0,"AllConversionRate":0.0,"AllCostPerConversion":null,"AllReturnOnAdSpend":0.0,"AllRevenuePerConversion":null,"ViewThroughConversions":0,"Goal":null,"GoalType":null,"AbsoluteTopImpressionRatePercent":59.09,"TopImpressionRatePercent":100.0,"AverageCpm":11.82,"ConversionsQualified":0.0,"AllConversionsQualified":0.0,"ViewThroughConversionsQualified":null,"Neighborhood":null,"QueryIntentNeighborhood":null,"ViewThroughRevenue":0.0,"CampaignType":"Search & content","AssetGroupId":null,"AssetGroupName":null},"emitted_at":1698264629208}
{"stream":"user_location_performance_report_monthly","data":{"AccountName":"Daxtarity Inc.","AccountNumber":"F149GKV5","AccountId":180278106,"TimePeriod":"2021-07-01","CampaignName":"Test 2","CampaignId":413444833,"AdGroupName":"Airbyte","AdGroupId":1352400325389092,"Country":"United States","State":"New York","MetroArea":"New York, NY","CurrencyCode":"USD","AdDistribution":"Search","Impressions":103,"Clicks":3,"Ctr":2.91,"AverageCpc":0.07,"Spend":0.21,"AveragePosition":0.0,"ProximityTargetLocation":null,"Radius":0,"Language":"English","City":"New York","QueryIntentCountry":"United States","QueryIntentState":null,"QueryIntentCity":null,"QueryIntentDMA":null,"BidMatchType":"Broad","DeliveredMatchType":"Phrase","Network":"Syndicated search partners","TopVsOther":"Syndicated search partners - Top","DeviceType":"Smartphone","DeviceOS":"Android","Assists":0,"Conversions":0,"ConversionRate":0.0,"Revenue":0.0,"ReturnOnAdSpend":0.0,"CostPerConversion":null,"CostPerAssist":null,"RevenuePerConversion":null,"RevenuePerAssist":null,"County":null,"PostalCode":null,"QueryIntentCounty":null,"QueryIntentPostalCode":null,"LocationId":59981,"QueryIntentLocationId":190,"AllConversions":0,"AllRevenue":0.0,"AllConversionRate":0.0,"AllCostPerConversion":null,"AllReturnOnAdSpend":0.0,"AllRevenuePerConversion":null,"ViewThroughConversions":0,"Goal":null,"GoalType":null,"AbsoluteTopImpressionRatePercent":3.88,"TopImpressionRatePercent":100.0,"AverageCpm":2.04,"ConversionsQualified":0.0,"AllConversionsQualified":0.0,"ViewThroughConversionsQualified":null,"Neighborhood":null,"QueryIntentNeighborhood":null,"ViewThroughRevenue":0.0,"CampaignType":"Search & content","AssetGroupId":null,"AssetGroupName":null},"emitted_at":1698264731347}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 47f25999-dd5e-4636-8c39-e7cea2453331
dockerImageTag: 1.2.0
dockerImageTag: 1.3.0
dockerRepository: airbyte/source-bing-ads
documentationUrl: https://docs.airbyte.com/integrations/sources/bing-ads
githubIssueLabel: source-bing-ads
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"AccountName": {
"type": ["null", "string"]
},
"AccountNumber": {
"type": ["null", "string"]
},
"AccountId": {
"type": ["null", "integer"]
},
"TimePeriod": {
"type": ["null", "string"]
},
"CampaignName": {
"type": ["null", "string"]
},
"CampaignId": {
"type": ["null", "integer"]
},
"AdGroupName": {
"type": ["null", "string"]
},
"AdGroupId": {
"type": ["null", "integer"]
},
"Country": {
"type": ["null", "string"]
},
"State": {
"type": ["null", "string"]
},
"MetroArea": {
"type": ["null", "string"]
},
"CurrencyCode": {
"type": ["null", "string"]
},
"AdDistribution": {
"type": ["null", "string"]
},
"Impressions": {
"type": ["null", "integer"]
},
"Clicks": {
"type": ["null", "integer"]
},
"Ctr": {
"type": ["null", "number"]
},
"AverageCpc": {
"type": ["null", "number"]
},
"Spend": {
"type": ["null", "number"]
},
"AveragePosition": {
"type": ["null", "number"]
},
"ProximityTargetLocation": {
"type": ["null", "string"]
},
"Radius": {
"type": ["null", "integer"]
},
"Language": {
"type": ["null", "string"]
},
"City": {
"type": ["null", "string"]
},
"QueryIntentCountry": {
"type": ["null", "string"]
},
"QueryIntentState": {
"type": ["null", "string"]
},
"QueryIntentCity": {
"type": ["null", "string"]
},
"QueryIntentDMA": {
"type": ["null", "string"]
},
"BidMatchType": {
"type": ["null", "string"]
},
"DeliveredMatchType": {
"type": ["null", "string"]
},
"Network": {
"type": ["null", "string"]
},
"TopVsOther": {
"type": ["null", "string"]
},
"DeviceType": {
"type": ["null", "string"]
},
"DeviceOS": {
"type": ["null", "string"]
},
"Assists": {
"type": ["null", "integer"]
},
"Conversions": {
"type": ["null", "integer"]
},
"ConversionRate": {
"type": ["null", "number"]
},
"Revenue": {
"type": ["null", "number"]
},
"ReturnOnAdSpend": {
"type": ["null", "number"]
},
"CostPerConversion": {
"type": ["null", "number"]
},
"CostPerAssist": {
"type": ["null", "number"]
},
"RevenuePerConversion": {
"type": ["null", "number"]
},
"RevenuePerAssist": {
"type": ["null", "number"]
},
"County": {
"type": ["null", "string"]
},
"PostalCode": {
"type": ["null", "string"]
},
"QueryIntentCounty": {
"type": ["null", "string"]
},
"QueryIntentPostalCode": {
"type": ["null", "string"]
},
"LocationId": {
"type": ["null", "integer"]
},
"QueryIntentLocationId": {
"type": ["null", "integer"]
},
"AllConversions": {
"type": ["null", "integer"]
},
"AllRevenue": {
"type": ["null", "number"]
},
"AllConversionRate": {
"type": ["null", "number"]
},
"AllCostPerConversion": {
"type": ["null", "number"]
},
"AllReturnOnAdSpend": {
"type": ["null", "number"]
},
"AllRevenuePerConversion": {
"type": ["null", "number"]
},
"ViewThroughConversions": {
"type": ["null", "integer"]
},
"Goal": {
"type": ["null", "string"]
},
"GoalType": {
"type": ["null", "string"]
},
"AbsoluteTopImpressionRatePercent": {
"type": ["null", "number"]
},
"TopImpressionRatePercent": {
"type": ["null", "number"]
},
"AverageCpm": {
"type": ["null", "number"]
},
"ConversionsQualified": {
"type": ["null", "number"]
},
"AllConversionsQualified": {
"type": ["null", "number"]
},
"ViewThroughConversionsQualified": {
"type": ["null", "number"]
},
"Neighborhood": {
"type": ["null", "string"]
},
"QueryIntentNeighborhood": {
"type": ["null", "string"]
},
"ViewThroughRevenue": {
"type": ["null", "number"]
},
"CampaignType": {
"type": ["null", "string"]
},
"AssetGroupId": {
"type": ["null", "integer"]
},
"AssetGroupName": {
"type": ["null", "string"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
SearchQueryPerformanceReportHourly,
SearchQueryPerformanceReportMonthly,
SearchQueryPerformanceReportWeekly,
UserLocationPerformanceReportDaily,
UserLocationPerformanceReportHourly,
UserLocationPerformanceReportMonthly,
UserLocationPerformanceReportWeekly,
)


Expand Down Expand Up @@ -85,6 +89,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Stream]:
"CampaignPerformanceReport",
"GeographicPerformanceReport",
"SearchQueryPerformanceReport",
"UserLocationPerformanceReport",
)
report_aggregation = ("Hourly", "Daily", "Weekly", "Monthly")
streams.extend([eval(f"{report}{aggregation}")(client, config) for (report, aggregation) in product(reports, report_aggregation)])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -902,3 +902,46 @@ class SearchQueryPerformanceReportWeekly(SearchQueryPerformanceReport):

class SearchQueryPerformanceReportMonthly(SearchQueryPerformanceReport):
report_aggregation = "Monthly"


class UserLocationPerformanceReport(PerformanceReportsMixin, BingAdsStream, ABC):
data_field: str = ""
service_name: str = "ReportingService"
report_name: str = "UserLocationPerformanceReport"
operation_name: str = "download_report"
additional_fields: str = ""
cursor_field = "TimePeriod"
report_schema_name = "user_location_performance_report"
primary_key = [
"AccountId",
"AdGroupId",
"CampaignId",
"DeliveredMatchType",
"DeviceOS",
"DeviceType",
"Language",
"LocationId",
"QueryIntentLocationId",
"TimePeriod",
"TopVsOther",
]

@property
def report_columns(self) -> List[str]:
return list(self.get_json_schema().get("properties", {}).keys())


class UserLocationPerformanceReportHourly(UserLocationPerformanceReport):
report_aggregation = "Hourly"


class UserLocationPerformanceReportDaily(UserLocationPerformanceReport):
report_aggregation = "Daily"


class UserLocationPerformanceReportWeekly(UserLocationPerformanceReport):
report_aggregation = "Weekly"


class UserLocationPerformanceReportMonthly(UserLocationPerformanceReport):
report_aggregation = "Monthly"
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def logger_mock_fixture():
@patch.object(source_bing_ads.source, "Client")
def test_streams_config_based(mocked_client, config):
streams = SourceBingAds().streams(config)
assert len(streams) == 37
assert len(streams) == 41


@patch.object(source_bing_ads.source, "Client")
Expand Down