We are trying to develop an analytics section in our site ( built in PHP). And we want to capture the search words which are used to find our website in search engines ( like Google.com) while it is redirected to our site.
Let's take an example, our site is "designsolution.com" and some people search in google with "best web designing company in Kanpur" and google.com showing our site on the first page. Then the user clicks on our site link and googles redirects the user to our site. Now, we want to know that the "best web designing company in Kanpur" used to search and find us.
Is there any way to get Google Search Terms/keywords in PHP? Any API service or any custom code? Please help.
I want to share my research here as I found many people also looking for it.
We can get Google Search keywords for our website using Google Webmaster console API
You need to sync or fetch data after Authorize Google Webmaster console API with your website.
Here is Search google search console API:
https://developers.google.com/webmaster-tools/search-console-api-original/v3/
Here is the sample code: https://developers.google.com/webmaster-tools/search-console-api-original/v3/samples
Another code library: https://github.com/googleapis/google-api-php-client-services
Thanks