Search Queries
On page load, the template reads the one URL param you name. If it has a value, the template sends the goal Search Queries with two custom props. search_query is the param value. search_source is the referrer URL.
Set up
- Add the Plausible template as a tag. Set Type to Initialization and enter your Script ID.
- Tick Enable Search Query Tracking.
- Set Search Query Param to
search. - Fire the tag on the Initialization or All Pages trigger. Open GTM preview mode on this site.
- In Plausible, create a custom event goal named
Search Queries.
Test
Use the forms and links. Each one is a full page load, which fires the tag again.
Expect
- The first form sends a
Search Queriesgoal withsearch_queryset to your text. - The second form sends nothing while the GTM param is
search. Change the GTM param toqueryand it sends one. - Plain text and symbols arrive decoded, for example
hello world & more. - An empty value or no params sends no goal.
- After a form submit,
search_sourceis the URL of the page that held the form. - After a link click,
search_sourceis the URL of the page that held the link. - After typing the URL,
search_sourceis empty. Plausible may drop the prop or store an empty value. Check which. - The template cannot report the number of results.