npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

google-pax-sdk

v1.0.9

Published

Type declaration files required to launch the partner ads experience (PAX)

Downloads

1,745

Readme

Partner Ads Experience (PAX) API

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 |

Quick start

Note: The following code assumes that you develop with Javascript.

Config setup

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 setup

Ads required services play the key role to communicate between the Ads app and the partner app during the Ads app running time.

OAuth data

let authInfoService = {
  get: ${get_access_info_impl},
  fix: ${fix_access_info_impl},
};

Conversion tracking

let conversionTrackingService = {
  getSupportedConversionLabels: ${get_supported_conversion_labels_impl},
  getPageViewConversionSetting: ${get_page_view_conversion_setting_impl},
  getSupportedConversionTrackingTypes:
  ${get_supported_conversion_tracking_types_impl},
};

Business info

let businessService = {
  getBusinessInfo: ${get_business_info_impl},
  fixBusinessInfo: ${fix_business_info_impl},
};

Terms and conditions

let termsAndConditionsService = {
  notify: ${notify_impl},
};

Account status

let accountStatusService = {
  disconnect: ${disconnect_impl},
};

Campaign service

let campaignService = {
  notifyNewCampaignCreated: ${notify_impl},
};

Partner date range service

let partnerDateRangeService = {
  get: ${get_date_range_impl},
};

User action service

let userActionService = {
  finishAndCloseSignUpFlow: ${finish_and_close_sign_up_flow_impl},
};

Wrap all Ads app required services

let paxServices = {
  authenticationService: authInfoService,
  businessService: businessService,
  conversionTrackingService: conversionTrackingService,
  termsAndConditionsService: termsAndConditionsService,
  accountStatusService: accountStatusService,
  campaignService: campaignService,
  partnerDateRangeService: partnerDateRangeService,
};

Launch with the integrator

// 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);

Get services supported by the Ads app

const adsAppHandler = await google.ads.integration.integrator.launchGoogleAds(paxConfig, paxServices);
const adsSupportedServices = adsAppHandler.getServices();

Get conversion tracking id from the Ads app

const ctService = adsSupportedServices.conversionTrackingService;
const conversionTrackingId = (await ctService.getConversionTrackingId(${get_conversion_tracking_id_request})).conversionTrackingId;

Get terms and conditions state from the Ads app

const accountService = adsSupportedServices.accountService;
const termsAndServicesIsAccepted = (await
accountService.getTermsAndConditionsState(${get_terms_and_conditions_state_request})).isAccepted;

Get account id from the Ads app

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;

Notify PAX about the updated date range

const adsDateRangeService = adsSupportedServices.adsDateRangeService;
const updatedDateRangeService = (await
adsDateRangeService.update(${update_selected_date_range_request}));

Disconnect the Ads app

const accountService = adsSupportedServices.accountService;
const disconnectIsSuccess = (await
accountService.disconnect(${disconnect_request})).isSuccess;

Contributing guidelines

Currently the GitHub repository is owned by Google Partner Ads Experience dev team. If you find any bugs, please report to: Google group.

Other resources

  • TBD: to be published

License

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.