The GoogleClient library provides an easy-to-use interface for interacting with Google Search Console APIs. It allows for secure retrieval of organic search data and site listings using OAuth2 authentication, with credentials managed via AWS Secrets Manager.
Install the package using npm:
npm install @adobe/spacecat-shared-google-client
-
GOOGLE_CLIENT_ID
: Google OAuth2 client ID -
GOOGLE_CLIENT_SECRET
: Google OAuth2 client secret -
GOOGLE_REDIRECT_URI
: Google OAuth2 redirect URI:- For dev environment: https://spacecat.experiencecloud.live/api/ci/auth/google
- For prod environment: https://spacecat.experiencecloud.live/api/v1/auth/google
import GoogleClient from '@adobe/spacecat-shared-google-client';
...
try {
const googleClient = await GoogleClient.createFrom(context, baseURL);
const result = await googleClient.getOrganicTrafficData(startDate, endDate);
} catch (error) {
// handle error
}
...
To run tests:
npm run test
Lint your code:
npm run lint
To remove node_modules
and package-lock.json
:
npm run clean
- Repository: GitHub
- Issue Tracking: GitHub Issues
- License: Apache-2.0