This Repository contains all of the interfaces needed to integrate with Google Partner Ads experience.
This SDK is required when you develop your app with Typescript. For javascript developer, this SDK is not required as part of your app library. But it is also useful to check the type declaration files during integration developing process.
Directory/file | Description |
---|---|
sdk/integrator.d.ts |
The Ads app integrator entry point |
sdk/config |
Configuration required by the Ads app to launch the partner ads experience |
sdk/required_services.d.ts |
Wrapper interface for all the communication required services |
sdk/services |
All service interfaces required to communicate between the partner app and the Ads app |
sdk/services/ads |
Services provided by the Ads app and called by the partner |
sdk/services/partner |
Services provided by the partner and called by the Ads app |
Note: The following code assumes that you develop with Javascript.
let paxConfig = {
authAccess: {
oauthTokenAccess: {
token: ${token},
}
},
locale: ${locale},
clientConfig: {
contentContainer: ${ads_container_element_id},
},
};
To add debugging config, set:
let paxConfig = {
authAccess: {
oauthTokenAccess: {
token: ${token},
}
},
locale: ${locale},
clientConfig: {
contentContainer: ${ads_container_element_id},
},
debuggingConfig: {
env: 'QA_PROD'
},
};
To add content config, set:
let paxConfig = {
authAccess: {
oauthTokenAccess: {
token: ${token},
}
},
locale: ${locale},
clientConfig: {
contentContainer: ${ads_container_element_id},
},
debuggingConfig: {
env: 'QA_PROD'
},
contentConfig: {
partnerAdsExperienceConfig: {
reportingStyle: 'REPORTING_STYLE_FULL'
},
},
};
Ads required services play the key role to communicate between the Ads app and the partner app during the Ads app running time.
let authInfoService = {
get: ${get_access_info_impl},
fix: ${fix_access_info_impl},
};
let conversionTrackingService = {
getSupportedConversionLabels: ${get_supported_conversion_labels_impl},
getPageViewConversionSetting: ${get_page_view_conversion_setting_impl},
getSupportedConversionTrackingTypes:
${get_supported_conversion_tracking_types_impl},
};
let businessService = {
getBusinessInfo: ${get_business_info_impl},
fixBusinessInfo: ${fix_business_info_impl},
};
let termsAndConditionsService = {
notify: ${notify_impl},
};
let accountStatusService = {
disconnect: ${disconnect_impl},
};
let campaignService = {
notifyNewCampaignCreated: ${notify_impl},
};
let partnerDateRangeService = {
get: ${get_date_range_impl},
};
let paxServices = {
authenticationService: authInfoService,
businessService: businessService,
conversionTrackingService: conversionTrackingService,
termsAndConditionsService: termsAndConditionsService,
accountStatusService: accountStatusService,
campaignService: campaignService,
partnerDateRangeService: partnerDateRangeService,
};
// Insert the script with integrator js file from Google gstatic.com.
let sc = document.createElement('script');
sc.src = 'https://www.gstatic.com/pax/${version}/pax_integrator.js';
document.body.append(sc);
// Create an element to launch the Ads app.
let rootContainer = document.getElementById(${root_element_id});
let adsContainer = document.createElement('div');
adsContainer.id = ${ads_container_element_id};
rootContainer.appendChild(adsContainer);
// Call launch api
google.ads.integration.integrator.launchGoogleAds(paxConfig, paxServices);
const adsAppHandler = await google.ads.integration.integrator.launchGoogleAds(paxConfig, paxServices);
const adsSupportedServices = adsAppHandler.getServices();
const ctService = adsSupportedServices.conversionTrackingService;
const conversionTrackingId = (await ctService.getConversionTrackingId(${get_conversion_tracking_id_request})).conversionTrackingId;
const accountService = adsSupportedServices.accountService;
const termsAndServicesIsAccepted = (await
accountService.getTermsAndConditionsState(${get_terms_and_conditions_state_request})).isAccepted;
const accountService = adsSupportedServices.accountService;
const customerId = (await
accountService.getAccountId(${get_account_id_request})).customerId;
const externalCustomerId = (await
accountService.getAccountId(${get_account_id_request})).externalCustomerId;
const formattedExternalCustomerId = (await
accountService.getAccountId(${get_account_id_request})).formattedExternalCustomerId;
const adsDateRangeService = adsSupportedServices.adsDateRangeService;
const updatedDateRangeService = (await
adsDateRangeService.update(${update_selected_date_range_request}));
const accountService = adsSupportedServices.accountService;
const disconnectIsSuccess = (await
accountService.disconnect(${disconnect_request})).isSuccess;
Currently the GitHub repository is owned by Google Partner Ads Experience dev team. If you find any bugs, please report to: Google group.
- TBD: to be published
Copyright 2023 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.