How do I track WordPress Ajax form when an ajaxComplete event is fired in Google Tag Manager?

103 Views Asked by At

Problem: Custom GTM javascript variables are becoming empty.

Details: I have configured Ajax Event Listener tag in Google Tag Manager which fires an event called “ajaxComplete”. I have also created variables to collect user data.

Then I have configured a GTM tag to collect user data (Name, Email, etc). Initially (After clicking on submit button) my js variables contains user data, but becomes empty when “ajaxComplete” event is fired.

I have triggered my GTM tag so that it can fire only when “ajaxComplete” event is fired. I have used “event.preventDefault” in my Ajax Listener tag.

Solution to this problem will be appreciated.

Thanks...

0

There are 0 best solutions below