Implementation:Mage ai Mage ai Google Ads Ads Schema
| Knowledge Sources | |
|---|---|
| Domains | Data_Integration, Google_Ads, Schema |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
JSON Schema definition for Google Ads ad records used by the Singer-based Google Ads source connector.
Description
The ads.json schema file defines the complete data structure for Google Ads ad entities as consumed by the tap_google_ads Singer-based source connector within Mage Integrations. At 1759 lines, this is a comprehensive schema covering all Google Ads ad types and their associated metadata.
The schema is typed as ["null", "object"] at the top level and defines the following key properties:
Scalar properties (simple types):
addedByGoogleAds-- boolean indicating if the ad was auto-created by GoogledevicePreference-- string for device targeting preferencedisplayUrl-- string for the display URL shown in the adid-- integer unique identifier for the adname-- string name of the adresourceName-- string Google Ads API resource namesystemManagedResourceSource-- string source identifier for system-managed resourcestrackingUrlTemplate-- string URL template for click trackingtype-- string ad type enumeration
Array properties:
finalAppUrls-- array ofFinalAppUrlobjects for app deep linksfinalMobileUrls-- array of strings for mobile landing page URLsfinalUrls-- array of strings for landing page URLsurlCollections-- array ofUrlCollectionobjectsurlCustomParameters-- array ofCustomParameterobjectsfinalUrlSuffix-- string suffix appended to final URLs
Ad type sub-objects (via $ref definitions):
appAd--AppAdInfoappEngagementAd--AppEngagementAdInfoappPreRegistrationAd--AppPreRegistrationAdInfocallAd--CallAdInfodisplayUploadAd--DisplayUploadAdInfoexpandedDynamicSearchAd--ExpandedDynamicSearchAdInfoexpandedTextAd--ExpandedTextAdInfogmailAd--GmailAdInfohotelAd--HotelAdInfoimageAd--ImageAdInfolegacyAppInstallAd--LegacyAppInstallAdInfolegacyResponsiveDisplayAd--LegacyResponsiveDisplayAdInfolocalAd--LocalAdInforesponsiveDisplayAd--ResponsiveDisplayAdInforesponsiveSearchAd--ResponsiveSearchAdInfoshoppingComparisonListingAd--ShoppingComparisonListingAdInfoshoppingProductAd--ShoppingProductAdInfoshoppingSmartAd--ShoppingSmartAdInfosmartCampaignAd--SmartCampaignAdInfotextAd--TextAdInfovideoAd--VideoAdInfovideoResponsiveAd--VideoResponsiveAdInfo
The definitions section includes detailed sub-schemas for each ad type, URL constraints (CountryConstraint, CountryConstraintList), and other nested structures.
Usage
This schema is automatically loaded by the Google Ads source connector during stream discovery. It is read from disk by the Source.load_schemas_from_folder() method and used to define the Singer catalog entry for the ads stream.
Code Reference
Source Location
- Repository: mage-ai
- File: mage_integrations/mage_integrations/sources/google_ads/tap_google_ads/schemas/ads.json
- Lines: 1-1759
Signature
{
"type": ["null", "object"],
"properties": {
"addedByGoogleAds": { "type": ["null", "boolean"] },
"appAd": { "$ref": "#/definitions/AppAdInfo" },
"appEngagementAd": { "$ref": "#/definitions/AppEngagementAdInfo" },
"callAd": { "$ref": "#/definitions/CallAdInfo" },
"devicePreference": { "type": ["null", "string"] },
"displayUploadAd": { "$ref": "#/definitions/DisplayUploadAdInfo" },
"displayUrl": { "type": ["null", "string"] },
"expandedDynamicSearchAd": { "$ref": "#/definitions/ExpandedDynamicSearchAdInfo" },
"expandedTextAd": { "$ref": "#/definitions/ExpandedTextAdInfo" },
"finalAppUrls": { "type": ["null", "array"], "items": { "$ref": "#/definitions/FinalAppUrl" } },
"finalMobileUrls": { "type": ["null", "array"] },
"finalUrls": { "type": ["null", "array"] },
"gmailAd": { "$ref": "#/definitions/GmailAdInfo" },
"hotelAd": { "$ref": "#/definitions/HotelAdInfo" },
"id": { "type": ["null", "integer"] },
"imageAd": { "$ref": "#/definitions/ImageAdInfo" },
"name": { "type": ["null", "string"] },
"resourceName": { "type": ["null", "string"] },
"responsiveDisplayAd": { "$ref": "#/definitions/ResponsiveDisplayAdInfo" },
"responsiveSearchAd": { "$ref": "#/definitions/ResponsiveSearchAdInfo" },
"shoppingComparisonListingAd": { "$ref": "#/definitions/ShoppingComparisonListingAdInfo" },
"shoppingProductAd": { "$ref": "#/definitions/ShoppingProductAdInfo" },
"smartCampaignAd": { "$ref": "#/definitions/SmartCampaignAdInfo" },
"textAd": { "$ref": "#/definitions/TextAdInfo" },
"trackingUrlTemplate": { "type": ["null", "string"] },
"type": { "type": ["null", "string"] },
"videoAd": { "$ref": "#/definitions/VideoAdInfo" },
"videoResponsiveAd": { "$ref": "#/definitions/VideoResponsiveAdInfo" }
},
"definitions": {
"CountryConstraint": { "countryCriterion": { "type": ["null", "string"] } },
"CountryConstraintList": { "type": ["null", "object"], "properties": { "..." : "..." } }
// ... additional ad type definitions (AppAdInfo, CallAdInfo, etc.)
}
}
Import
# Loaded automatically by Source.load_schemas_from_folder()
# The schema file is discovered by convention from the schemas/ directory
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | JSON file | Yes | Loaded from disk by the schema loader during stream discovery |
Outputs
| Name | Type | Description |
|---|---|---|
| schema | dict | JSON Schema object defining property names, types (null, boolean, string, integer, array, object), format constraints, and $ref definitions for all Google Ads ad types |
Usage Examples
import json
schema_path = "mage_integrations/mage_integrations/sources/google_ads/tap_google_ads/schemas/ads.json"
with open(schema_path) as f:
schema = json.load(f)
# List top-level properties
print(list(schema["properties"].keys())[:10])
# ['addedByGoogleAds', 'appAd', 'appEngagementAd', 'appPreRegistrationAd',
# 'callAd', 'devicePreference', 'displayUploadAd', 'displayUrl',
# 'expandedDynamicSearchAd', 'expandedTextAd']
# Check the type of a specific property
print(schema["properties"]["id"])
# {'type': ['null', 'integer']}
# List all ad type definitions
print(list(schema.get("definitions", {}).keys())[:5])
# ['CountryConstraint', 'CountryConstraintList', 'AppAdInfo', ...]