Learn business growth with Google Analytics 4 › Forums › Google Analytics 4 › How to track user search keywords with Google Analytics and Search Console? › Reply To: How to track user search keywords with Google Analytics and Search Console?
-
Sure, man! This is actually about setting up Google’s Search Console to find what terms people are searching that lead them to your website. The Search Console is a Google version of a gold mine for website owners that shows what keywords people are using to find your site. This little nugget of info suggests using node.js to get these details.
The provided code is basically setting up a route ‘/getKeywords’ in your server to give back the search data. It tries to contact Google’s search console with your site URL and the date range you want the search data for. If it manages to do that without a hitch, it will map the data into a simple keyword list, and send it back as a reply. If something goes wrong, it will just notify that an error occurred. Pretty neat, eh?