From d3938007a96d9e10e658eb3871bca531f64a7275 Mon Sep 17 00:00:00 2001 From: towfiqi Date: Sun, 3 Mar 2024 21:34:45 +0600 Subject: [PATCH] chore: renames Google Adwords to Google Ads --- components/domains/DomainHeader.tsx | 2 +- components/ideas/KeywordIdeasTable.tsx | 2 +- components/ideas/KeywordIdeasUpdater.tsx | 2 +- components/settings/AdWordsSettings.tsx | 10 +++---- components/settings/IntegrationSettings.tsx | 2 +- pages/api/adwords.ts | 20 +++++++------- pages/api/volume.ts | 2 +- pages/domain/ideas/[slug]/index.tsx | 2 +- pages/research/index.tsx | 2 +- services/adwords.tsx | 4 +-- utils/adwords.ts | 30 ++++++++++----------- 11 files changed, 39 insertions(+), 39 deletions(-) diff --git a/components/domains/DomainHeader.tsx b/components/domains/DomainHeader.tsx index ea14b50..7c896ac 100644 --- a/components/domains/DomainHeader.tsx +++ b/components/domains/DomainHeader.tsx @@ -83,7 +83,7 @@ const DomainHeader = ( size={14} color="#aaa" classes="ml-2 hidden lg:inline-block" - title='Get Keyword Ideas for this domain from Google Adwords' + title='Get Keyword Ideas for this domain from Google Ads' /> diff --git a/components/ideas/KeywordIdeasTable.tsx b/components/ideas/KeywordIdeasTable.tsx index e2d5527..768f995 100644 --- a/components/ideas/KeywordIdeasTable.tsx +++ b/components/ideas/KeywordIdeasTable.tsx @@ -229,7 +229,7 @@ const IdeasKeywordsTable = ({ )} {!isAdwordsIntegrated && (

- Google Adwords has not been Integrated yet. Please follow These Steps to integrate Google Adwords. + Google Ads has not been Integrated yet. Please follow These Steps to integrate Google Ads.

)} diff --git a/components/ideas/KeywordIdeasUpdater.tsx b/components/ideas/KeywordIdeasUpdater.tsx index 2f0c5e9..63fe495 100644 --- a/components/ideas/KeywordIdeasUpdater.tsx +++ b/components/ideas/KeywordIdeasUpdater.tsx @@ -127,7 +127,7 @@ const KeywordIdeasUpdater = ({ onUpdate, settings, domain, searchConsoleConnecte diff --git a/components/settings/AdWordsSettings.tsx b/components/settings/AdWordsSettings.tsx index d1bbcfa..a7ca20f 100644 --- a/components/settings/AdWordsSettings.tsx +++ b/components/settings/AdWordsSettings.tsx @@ -86,7 +86,7 @@ const AdWordsSettings = ({ settings, settingsError, updateSettings, performUpdat
{!cloudProjectIntegrated &&
} -

Step 2: Connect Google AdWords

+

Step 2: Connect Google Ads

updateSettings('adwords_account_id', account_id)} value={adwords_account_id} placeholder='590-948-9101' @@ -112,7 +112,7 @@ const AdWordsSettings = ({ settings, settingsError, updateSettings, performUpdat title={hasAllCredentials ? '' : 'Insert All the data in the above fields to Test the Integration'} onClick={testIntegration}> {isTesting && } - Test AdWords Integration + Test Google Ads Integration
@@ -130,13 +130,13 @@ const AdWordsSettings = ({ settings, settingsError, updateSettings, performUpdat ${hasAllCredentials ? 'cursor-pointer' : 'cursor-not-allowed opacity-40'} hover:bg-blue-700 hover:text-white transition`} onClick={updateVolumeData}> - Update Keywords Volume + Update Keywords Volume Data

- Integrate Google Adwords to get Keyword Ideas & Search Volume.{' '} + Relevant Documentation: Integrate Google Ads.

diff --git a/components/settings/IntegrationSettings.tsx b/components/settings/IntegrationSettings.tsx index dea92d0..8a3eb07 100644 --- a/components/settings/IntegrationSettings.tsx +++ b/components/settings/IntegrationSettings.tsx @@ -28,7 +28,7 @@ const IntegrationSettings = ({ settings, settingsError, updateSettings, performU
  • setCurrentTab('adwords')}> - Adwords + Google Ads
  • diff --git a/pages/api/adwords.ts b/pages/api/adwords.ts index 3ba3956..be38fdb 100644 --- a/pages/api/adwords.ts +++ b/pages/api/adwords.ts @@ -43,31 +43,31 @@ const getAdwordsRefreshToken = async (req: NextApiRequest, res: NextApiResponse< if (r?.tokens?.refresh_token) { const adwords_refresh_token = cryptr.encrypt(r.tokens.refresh_token); await writeFile(`${process.cwd()}/data/settings.json`, JSON.stringify({ ...settings, adwords_refresh_token }), { encoding: 'utf-8' }); - return res.status(200).send('Adwords Intergrated Successfully! You can close this window.'); + return res.status(200).send('Google Ads Intergrated Successfully! You can close this window.'); } - return res.status(200).send('Error Getting the Adwords Refresh Token. Please Try Again!'); + return res.status(200).send('Error Getting the Google Ads Refresh Token. Please Try Again!'); } catch (error) { - console.log('[Error] Getting Adwords Refresh Token!'); + console.log('[Error] Getting Google Ads Refresh Token!'); console.log('error :', error); - return res.status(200).send('Error Saving the Adwords Refresh Token. Please Try Again!'); + return res.status(200).send('Error Saving the Google Ads Refresh Token. Please Try Again!'); } } else { return res.status(200).send('No Code Provided By Google. Please Try Again!'); } } catch (error) { console.log('[ERROR] CRON Refreshing Keywords: ', error); - return res.status(400).send('Error Getting Adwords Refresh Token. Please Try Again!'); + return res.status(400).send('Error Getting Google Ads Refresh Token. Please Try Again!'); } }; const validateAdwordsIntegration = async (req: NextApiRequest, res: NextApiResponse) => { - const errMsg = 'Error Validating Adwords Integration. Please make sure your provided data are correct!'; + const errMsg = 'Error Validating Google Ads Integration. Please make sure your provided data are correct!'; const { developer_token, account_id } = req.body; if (!developer_token || !account_id) { - return res.status(400).json({ valid: false, error: 'Please Provide the Adwords Developer Token and Test Account ID' }); + return res.status(400).json({ valid: false, error: 'Please Provide the Google Ads Developer Token and Test Account ID' }); } try { - // Save the Adwords Developer Token & Adwords Test Account ID in App Settings + // Save the Adwords Developer Token & Google Ads Test Account ID in App Settings const settingsRaw = await readFile(`${process.cwd()}/data/settings.json`, { encoding: 'utf-8' }); const settings: SettingsType = settingsRaw ? JSON.parse(settingsRaw) : {}; const cryptr = new Cryptr(process.env.SECRET as string); @@ -76,7 +76,7 @@ const validateAdwordsIntegration = async (req: NextApiRequest, res: NextApiRespo const securedSettings = { ...settings, adwords_developer_token, adwords_account_id }; await writeFile(`${process.cwd()}/data/settings.json`, JSON.stringify(securedSettings), { encoding: 'utf-8' }); - // Make a test Request to Google Adwords + // Make a test Request to Google Ads const adwordsCreds = await getAdwordsCredentials(); const { client_id, client_secret, refresh_token } = adwordsCreds || {}; if (adwordsCreds && client_id && client_secret && developer_token && account_id && refresh_token) { @@ -91,7 +91,7 @@ const validateAdwordsIntegration = async (req: NextApiRequest, res: NextApiRespo } return res.status(400).json({ valid: false, error: errMsg }); } catch (error) { - console.log('[ERROR] Validating AdWords Integration: ', error); + console.log('[ERROR] Validating Google Ads Integration: ', error); return res.status(400).json({ valid: false, error: errMsg }); } }; diff --git a/pages/api/volume.ts b/pages/api/volume.ts index a2aabcd..29730c0 100644 --- a/pages/api/volume.ts +++ b/pages/api/volume.ts @@ -55,7 +55,7 @@ const updatekeywordVolume = async (req: NextApiRequest, res: NextApiResponse { {showUpdateModal && activDomain?.domain && ( - setShowUpdateModal(false) } title={'Load Keyword Ideas from Google Adwords'} verticalCenter={true}> + setShowUpdateModal(false) } title={'Load Keyword Ideas from Google Ads'} verticalCenter={true}> setShowUpdateModal(false)} diff --git a/pages/research/index.tsx b/pages/research/index.tsx index 92f54fd..7430704 100644 --- a/pages/research/index.tsx +++ b/pages/research/index.tsx @@ -108,7 +108,7 @@ const Research: NextPage = () => { diff --git a/services/adwords.tsx b/services/adwords.tsx index dd5b7ef..f8e2dd7 100644 --- a/services/adwords.tsx +++ b/services/adwords.tsx @@ -14,14 +14,14 @@ export function useTestAdwordsIntegration(onSuccess?: Function) { }, { onSuccess: async (data) => { console.log('Ideas Added:', data); - toast('Google Adwords has been integrated successfully!', { icon: '✔️' }); + toast('Google Ads has been integrated successfully!', { icon: '✔️' }); if (onSuccess) { onSuccess(false); } }, onError: (error) => { console.log('Error Loading Keyword Ideas!!!', error); - toast('Failed to connect to Google Adwords. Please make sure you have provided the correct API info.', { icon: '⚠️' }); + toast('Failed to connect to Google Ads. Please make sure you have provided the correct API info.', { icon: '⚠️' }); }, }); } diff --git a/utils/adwords.ts b/utils/adwords.ts index 260c87f..a4e51a7 100644 --- a/utils/adwords.ts +++ b/utils/adwords.ts @@ -48,7 +48,7 @@ export type KeywordIdeasDatabase = { } /** - * The function `getAdwordsCredentials` reads and decrypts Adwords credentials from the App settings file. + * The function `getAdwordsCredentials` reads and decrypts Google Ads credentials from the App settings file. * @returns {Promise} returns either a decrypted `AdwordsCredentials` object if the settings are successfully decrypted, * or `false` if the decryption process fails. */ @@ -86,7 +86,7 @@ export const getAdwordsCredentials = async (): Promise} the fetched access token or an empty string if failed. */ @@ -107,15 +107,15 @@ export const getAdwordsAccessToken = async (credentials:AdwordsCredentials) => { }; /** - * The function `getAdwordsKeywordIdeas` retrieves keyword ideas from Google AdWords API based on + * The function `getAdwordsKeywordIdeas` retrieves keyword ideas from Google Ads API based on * provided credentials and settings. - * @param {AdwordsCredentials} credentials - an object containing Adwords credentials needed to authenticate + * @param {AdwordsCredentials} credentials - an object containing Google Ads credentials needed to authenticate * the API request. * @param {IdeaSettings} adwordsDomainOptions - an object that contains settings and options for fetching - * keyword ideas from Google AdWords. + * keyword ideas from Google Ads. * @param {boolean} [test=false] - a boolean flag that indicates whether the function is being run in a test mode or not. * When `test` is set to `true`, only 1 keyword is requested from adwords. - * @returns returns an array of fetched keywords (`fetchedKeywords`) after processing the Adwords API response. + * @returns returns an array of fetched keywords (`fetchedKeywords`) after processing the Google Ads API response. */ export const getAdwordsKeywordIdeas = async (credentials:AdwordsCredentials, adwordsDomainOptions:IdeaSettings, test:boolean = false) => { if (!credentials) { return false; } @@ -191,8 +191,8 @@ export const getAdwordsKeywordIdeas = async (credentials:AdwordsCredentials, adw const ideaData = await resp.json(); if (resp.status !== 200) { - console.log('[ERROR] Adwords Response :', ideaData?.error?.details[0]?.errors[0]?.message); - // console.log('Response from AdWords :', JSON.stringify(ideaData, null, 2)); + console.log('[ERROR] Google Ads Response :', ideaData?.error?.details[0]?.errors[0]?.message); + // console.log('Response from Ads :', JSON.stringify(ideaData, null, 2)); } if (ideaData?.results) { @@ -203,7 +203,7 @@ export const getAdwordsKeywordIdeas = async (credentials:AdwordsCredentials, adw await updateLocalKeywordIdeas(domain, { keywords: fetchedKeywords, settings: adwordsDomainOptions }); } } catch (error) { - console.log('[ERROR] Fetching Keyword Ideas from Adwords :', error); + console.log('[ERROR] Fetching Keyword Ideas from Google Ads :', error); } } @@ -254,7 +254,7 @@ const extractAdwordskeywordIdeas = (keywordIdeas:keywordIdeasResponseItem[], opt }; /** - * Retrieves keyword search volumes from Google Adwords API based on provided keywords and their countries. + * Retrieves keyword search volumes from Google Ads API based on provided keywords and their countries. * @param {KeywordType[]} keywords - The keywords that you want to get the search volume data for. * @returns returns a Promise that resolves to an object with a `volumes` and error `proprties`. * The `volumes` propery which outputs `false` if the request fails and outputs the volume data in `{[keywordID]: volume}` object if succeeds. @@ -262,10 +262,10 @@ const extractAdwordskeywordIdeas = (keywordIdeas:keywordIdeasResponseItem[], opt */ export const getKeywordsVolume = async (keywords: KeywordType[]): Promise<{error?: string, volumes: false | Record}> => { const credentials = await getAdwordsCredentials(); - if (!credentials) { return { error: 'Cannot Load Adwords Credentials', volumes: false }; } + if (!credentials) { return { error: 'Cannot Load Google Ads Credentials', volumes: false }; } const { client_id, client_secret, developer_token, account_id } = credentials; if (!client_id || !client_secret || !developer_token || !account_id) { - return { error: 'Adwords Not Integrated Properly', volumes: false }; + return { error: 'Google Ads Not Integrated Properly', volumes: false }; } // Generate Access Token @@ -319,8 +319,8 @@ export const getKeywordsVolume = async (keywords: KeywordType[]): Promise<{error const ideaData = await resp.json(); if (resp.status !== 200) { - console.log('[ERROR] Adwords Volume Request Response :', ideaData?.error?.details[0]?.errors[0]?.message); - console.log('Response from AdWords :', JSON.stringify(ideaData, null, 2)); + console.log('[ERROR] Google Ads Volume Request Response :', ideaData?.error?.details[0]?.errors[0]?.message); + // console.log('Response from Google Ads :', JSON.stringify(ideaData, null, 2)); } if (ideaData?.results) { @@ -344,7 +344,7 @@ export const getKeywordsVolume = async (keywords: KeywordType[]): Promise<{error } } } catch (error) { - console.log('[ERROR] Fetching Keyword Volume from Adwords :', error); + console.log('[ERROR] Fetching Keyword Volume from Google Ads :', error); } if (Object.keys(keywordRequests).length > 1) { await sleep(7000);