chore: renames Google Adwords to Google Ads

This commit is contained in:
towfiqi 2024-03-03 21:34:45 +06:00
parent 252ae9aa84
commit d3938007a9
11 changed files with 39 additions and 39 deletions

View File

@ -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'
/>
</a>
</Link>

View File

@ -229,7 +229,7 @@ const IdeasKeywordsTable = ({
)}
{!isAdwordsIntegrated && (
<p className=' p-9 pt-[10%] text-center text-gray-500'>
Google Adwords has not been Integrated yet. Please follow <a className='text-indigo-600 underline' href='https://docs.serpbear.com/miscellaneous/integrate-google-adwords' target="_blank" rel='noreferrer'>These Steps</a> to integrate Google Adwords.
Google Ads has not been Integrated yet. Please follow <a className='text-indigo-600 underline' href='https://docs.serpbear.com/miscellaneous/integrate-google-ads' target="_blank" rel='noreferrer'>These Steps</a> to integrate Google Ads.
</p>
)}
</div>

View File

@ -127,7 +127,7 @@ const KeywordIdeasUpdater = ({ onUpdate, settings, domain, searchConsoleConnecte
<button
className={`w-full py-2 px-5 mt-2 rounded bg-blue-700 text-white
font-semibold ${!adwordsConnected ? ' cursor-not-allowed opacity-40' : 'cursor-pointer'}`}
title={!adwordsConnected ? 'Please Connect Adwords account to generate Keyword Ideas..' : ''}
title={!adwordsConnected ? 'Please Connect Ads account to generate Keyword Ideas..' : ''}
onClick={() => !isUpdatingIdeas && adwordsConnected && reloadKeywordIdeas()}>
<Icon type={isUpdatingIdeas ? 'loading' : 'reload'} size={12} /> {isUpdatingIdeas ? 'Loading....' : 'Load Keyword Ideas'}
</button>

View File

@ -86,7 +86,7 @@ const AdWordsSettings = ({ settings, settingsError, updateSettings, performUpdat
</div>
<div className='mt-4 border-t mb-4 border-b border-gray-100 pt-4 pb-0 relative'>
{!cloudProjectIntegrated && <div className=' absolute w-full h-full z-50' />}
<h4 className=' mb-3 font-semibold text-blue-700'>Step 2: Connect Google AdWords</h4>
<h4 className=' mb-3 font-semibold text-blue-700'>Step 2: Connect Google Ads</h4>
<div className={!cloudProjectIntegrated ? 'opacity-40' : ''}>
<div className="settings__section__input mb-4 flex justify-between items-center w-full">
<SecretField
@ -98,7 +98,7 @@ const AdWordsSettings = ({ settings, settingsError, updateSettings, performUpdat
</div>
<div className="settings__section__input mb-4 flex justify-between items-center w-full">
<SecretField
label='AdWords Test Account ID'
label='Test Account ID'
onChange={(account_id:string) => 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 && <Icon type='loading' />}
<Icon type='adwords' size={14} /> Test AdWords Integration
<Icon type='adwords' size={14} /> Test Google Ads Integration
</button>
</div>
</div>
@ -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}>
<Icon type={isUpdatingVolume ? 'loading' : 'reload'} size={isUpdatingVolume ? 16 : 12} /> Update Keywords Volume
<Icon type={isUpdatingVolume ? 'loading' : 'reload'} size={isUpdatingVolume ? 16 : 12} /> Update Keywords Volume Data
</button>
</div>
</div>
</div>
<p className='mb-4 text-xs'>
<a target='_blank' rel='noreferrer' href='https://docs.serpbear.com/keyword-research' className=' underline text-blue-600'>Integrate Google Adwords</a> to get Keyword Ideas & Search Volume.{' '}
Relevant Documentation: <a target='_blank' rel='noreferrer' href='https://docs.serpbear.com/miscellaneous/integrate-google-ads' className=' underline text-blue-600'>Integrate Google Ads</a>.
</p>
</div>
</div>

View File

@ -28,7 +28,7 @@ const IntegrationSettings = ({ settings, settingsError, updateSettings, performU
<li
className={`${tabStyle} ${currentTab === 'adwords' ? ' bg-blue-50 text-blue-600' : ''}`}
onClick={() => setCurrentTab('adwords')}>
<Icon type='adwords' size={14} /> Adwords
<Icon type='adwords' size={14} /> Google Ads
</li>
</ul>
</div>

View File

@ -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<adwordsValidateResp>) => {
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 });
}
};

View File

@ -55,7 +55,7 @@ const updatekeywordVolume = async (req: NextApiRequest, res: NextApiResponse<Key
}
}
} else {
return res.status(400).json({ error: 'Error Fetching Keywords Volume Data from Google Adwords' });
return res.status(400).json({ error: 'Error Fetching Keywords Volume Data from Google Ads' });
}
}

View File

@ -95,7 +95,7 @@ const DiscoverPage: NextPage = () => {
</CSSTransition>
{showUpdateModal && activDomain?.domain && (
<Modal closeModal={() => setShowUpdateModal(false) } title={'Load Keyword Ideas from Google Adwords'} verticalCenter={true}>
<Modal closeModal={() => setShowUpdateModal(false) } title={'Load Keyword Ideas from Google Ads'} verticalCenter={true}>
<KeywordIdeasUpdater
domain={activDomain}
onUpdate={() => setShowUpdateModal(false)}

View File

@ -108,7 +108,7 @@ const Research: NextPage = () => {
<button
className={`w-full py-2 px-5 mt-2 rounded bg-blue-700 text-white
font-semibold ${!adwordsConnected ? ' cursor-not-allowed opacity-40' : 'cursor-pointer'}`}
title={!adwordsConnected ? 'Please Connect Adwords account to generate Keyword Ideas..' : ''}
title={!adwordsConnected ? 'Please Connect Google Ads account to generate Keyword Ideas..' : ''}
onClick={() => !isUpdatingIdeas && adwordsConnected && reloadKeywordIdeas()}>
<Icon type={isUpdatingIdeas ? 'loading' : 'download'} size={14} /> {isUpdatingIdeas ? 'Loading....' : 'Load Ideas'}
</button>

View File

@ -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: '⚠️' });
},
});
}

View File

@ -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<false | AdwordsCredentials>} 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<false | AdwordsCredential
};
/**
* retrieves an access token using Adwords credentials for Google API authentication.
* retrieves an access token using Google Ads credentials for Google API authentication.
* @param {AdwordsCredentials} credentials - The `credentials` to use to generate the access token,
* @returns {Promise<string>} 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<number, number>}> => {
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);