Frase Event Listener

You can listen to specific events in Frase, and add custom code accordingly. For example, this can be useful to send custom events to other Analytics tools, or CRM.

IMPORTANT: Frase's Event Listener should also always come after the Javascript snippet you copy pasted to install Frase. 

Currently, Frase supports the following events:

  • ready: when Frase is installed and ready to be used.
  • frase_input: new question asked by user.
  • frase_funnel: new answer funnel completed.
frase.on("ready", function(){    
	
	frase.on("frase_input", function(){  
		// DO SOMETHING	
	});

	frase.on("frase_funnel", function(){  
		// DO SOMETHING	
	});
});

Usage Example: Passing Events to Google Analytics

In the example below, we use the Event Listener to send a custom event to Google Analytics every time a user engages with Frase.

frase.on("ready", function(){     	 	

	frase.on("frase_input", function(){   		
		ga("send", {
    			hitType: "event",
    			eventCategory: "frase",
   			eventLabel: "frase_input"
		});	
	});  	

});