LENIN K RAJ
LENIN K RAJ

Reputation: 11

Query parameter for Google Analytics to track my Ajax Searches inside my Website

I want to track my searches on my website, so I have set up tracking in google analytics.

It started to track queries perfectly as I set up “s” as a query parameter.

However, tracking is happening to people who have clicked on the search button which takes you to the search result page.

Example: https://keralagardens.buzz/?s=rose&post_type=product&product_cat=0

But for me, I want to track ajax search also, so could you please tell me the query parameter for Google analytics tracking?

Ajax request format https://keralagardens.buzz/wp-admin/admin-ajax.php?action=woodmart_ajax_search&number=20&post_type=product&product_cat=0&query=rosee

Thanks

Upvotes: 1

Views: 281

Answers (1)

Michele Pisani
Michele Pisani

Reputation: 14189

You have to send a virtual pageview to Google Analytics each time you show ajax result:

https://developers.google.com/analytics/devguides/collection/analyticsjs/pages#tracking_virtual_pageviews

Upvotes: 1

Related Questions