Follow

Using javascript to track new inquiries and application starts

When you embed your inquiry form or the initial application form on a page in your school's website, you can use javascript to track new inquiries and application starts. (You can easily adapt this code to record form response starts for embedded forms).

New Inquiries

  • The inquiry iframe sends the message inquiry.submitted to the parent page when an inquiry submits the form.
  • Your Javascript can then trigger an event when one of those messages is received.

To listen for these messages, you'll need Javascript code on your container page along these lines:

		
window.addEventListener('message',function(message){
	if(message.data.type == 'populi.inquiry.submitted'){
    	alert('Do it!');
	}
});

Application Starts

  • The application iframe sends the message application.start to the parent page when an applicant submits the initial form.
  • Your Javascript can then trigger an event when one of those messages is received.

To listen for these messages, add Javascript to your container page that goes something like this:

		
window.addEventListener('message',function(message){
	if(message.data.type == 'populi.application.start'){
    	alert('Do it!');
	}
});
Was this article helpful?
0 out of 0 found this helpful
Submit a request

0 Comments

Article is closed for comments.