LoopFuse and PHPBB

From LoopFuse Wiki

Jump to: navigation, search

Capturing leads with a Javascript Post

The example below users PHPBB as the use-case, as PHPBB has odd security requirements, LoopFuse is not able to integrate with the Registration Form and perform a repost.

Requirements

Instructions

  • Download the prototype library and place it in a web-accessible directory.
  • Add the prototype.js reference to the header of your PHPBB installation:
    • Edit /phpBBDirectory/templates/subSilver/overall_header.tpl
    • Add the following line, in between the <head> tags:
<script src="http://www.path/to/prototype.js" type="text/javascript"></script>
  • Edit /phpBBDirectory/templates/subSilver/profile_add_body.tpl
    • Look for
<form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post">

modify it to read as:

<form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post" onSubmit="doLoopFuse();" name="phpRegForm">
  • Add the Form ID of your form AND your Customer ID to the form:
<input type="hidden" name="formid" value="[SOME FORM ID]"/>
<input type="hidden" name="cid" value="[YOUR CID]"/>
  • Add the following JavaScript to this template page. This javascript will be responsible for submitting the form in the background, transparent to the user.
<script type="text/javascript">
function doLoopFuse() {
  var form = document.phpRegForm;
  var qs = Form.serialize(form);
  var loopFuseURL = "http://www.loopfuse.net/webrecorder/post?"  + qs;
  var iframe = document.createElement('IFRAME');
  iframe.setAttribute('id', 'loopfuse');
  iframe.setAttribute('width', 1);
  iframe.setAttribute('height', 1);
  iframe.setAttribute('name', 'loopfuse');
  iframe.setAttribute('src', loopFuseURL);
  document.body.appendChild(iframe);
  doDomFix(2000);
}
function doDomFix(mils) {
  var date = new Date();
  var curDate = null;
  do { curDate = new Date(); }
  while(curDate-date < mils);
}
</script>

Now, when a user submits the registration form, all data will be serialized and passed to LoopFuse via the added Javascript. You are free to modify the javascript, to your liking, and may need to increase/decrease the amount of milliseconds passed in to doDomFix, depending on performance and network latency.

Personal tools