Counting the number of keywords in a query
When you start analyzing your positioning on search engines, one interesting KPI to look at is the number of keywords in the queries that generated traffic to your website.
Unfortunately, it is not a default value provided by Google Analytics or Google Search Console so we will need to calculate it thanks to a calculated field.
Google Search Console
After you have imported the "Google Search Console - Impression" data source to your report, create a new table containing only the "query" dimension.
Click on the button "Add dimension", give a name to your dimension (ex "# keywords") and paste the below code:
This function will calculate the number of spaces in the query and increment it by one, which will give us the number of keywords in the query :)
It is also possible to do the same calculation with information coming from Google Analytics data source. The only change compare to the previous function is the dimension name, which should be "keyword" instead of "query".