Is there a way within this module to also send over the Eloqua GUID information while submitting the form to Eloqua?

If so, how can this be achieved?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drupalninja99’s picture

I thought it did this already? Do you have any documentation you can reference?

aziznana786’s picture

I am not sure about documentation, but with each form submission - there should be some hidden information that is sent along with the form submit. This information would be pulled from the individuals cookie making use of the Eloqua tracking information on the site. It normally uses a JS to pull the info or specific code as shown below:

<SCRIPT TYPE='text/javascript' LANGUAGE='JavaScript'><!--//
var timerId = null, timeout = 5;
//--></SCRIPT>
<SCRIPT TYPE='text/javascript' LANGUAGE='JavaScript'><!--//
function WaitUntilCustomerGUIDIsRetrieved() {
if (!!(timerId)) {
    if (timeout == 0) {
return;
}
if (typeof this.GetElqCustomerGUID === 'function') {
        document.forms["0inonahospitality"].elements["elqCustomerGUID"].value = GetElqCustomerGUID();
return;
}
timeout -= 1;
}
timerId = setTimeout("WaitUntilCustomerGUIDIsRetrieved()", 500);
return;
}
window.onload = WaitUntilCustomerGUIDIsRetrieved;
_elqQ.push(['elqGetCustomerGUID']);
//--></SCRIPT>
drupalninja99’s picture

I am pretty sure we have this code already. It puts the GUID in a hidden variable. It's difficult to test though to know if it's working properly.

aziznana786’s picture

What else does it send in the backend when a form is submitted?

I am assuming the following:
elqFormName - from the form itself
elqSiteID - from the configuration
elqCustomerGUID - getting pulled via the module
elqCookieWrite - not sure about this one.

the last one is supposed to have a "0" - is this sent automatically, or do we need to configure on the form.

Is there any way to see the cron post to Eloqua to see what info was passed i.e. if the GUID was passed correctly. I'm currently not getting any tracking.

Thank you!

aziznana786’s picture

Seems I am still having the same problem.

I have my page tracking, my script for the form and everything intact (forms send to Eloqua fine) - however the GUID is not beign passed over when the form is being submitted. I think it may have to do with the JavaScript for the form to pull teh GUID?

Really need some help with this.

drupalninja99’s picture

So the way it's supposed to work is there is a hidden variable called 'elqCustomerGUID' that gets populated with the customer GUID via javascript when the webform is submitted.

Here is the section of code where this happens:

$form['eloqua']['elqCustomerGUID'] = array(
    '#type' => 'hidden',
    '#default_value' => '',
  );
  // Drupal 7 doesn't automatically give hidden elements an #id.
  $form['eloqua']['elqCustomerGUID']['#attributes']['id'] = 'edit-elqCustomerGUID';
  $form['eloqua']['elqCookieWrite'] = array(
    '#type' => 'hidden',
    '#default_value' => 0,
  );

  drupal_add_js('var timerId = null, timeout = 5;', 'inline');

  $init_script
    = 'function WaitUntilCustomerGUIDIsRetrieved() {
    if (!!(timerId)) {
      if (timeout == 0) {
        return;
      }
      if (typeof this.GetElqCustomerGUID === \'function\') {
        document.forms["' . check_plain($form_settings['form_name']) . '"].elements["elqCustomerGUID"].value = GetElqCustomerGUID();
        return;
      }
      timeout -= 1;
    }
    timerId = setTimeout("WaitUntilCustomerGUIDIsRetrieved()", 500);
    return;
  }

  window.onload = WaitUntilCustomerGUIDIsRetrieved;
  _elqQ.push([\'elqGetCustomerGUID\']);';

Now this code was ported from D6. It's very possible there is a bug somewhere and this is hard for me to test. So that has been the holdup thus far.

drupalninja99’s picture

The issue I am seeing is that it doesn't appear GetElqCustomerGUID() is defined. I would think one of our script includes would have this function but something is up with our javascript which leads this code never to get called.

drupalninja99’s picture

drupalninja99’s picture

Fixed in https://drupal.org/node/1905500 thx to an old patch. I will create a new release.

drupalninja99’s picture

Issue summary: View changes
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

pearl.liang’s picture

Status: Closed (fixed) » Active

Hi Jay
Just want to let you know that I test "GUID" feature using a real eloqua account and it doesn't work. GUID value in the hidden field is blank.
Good news is that when I try to paste these codes below from this post (http://topliners.eloqua.com/thread/9388) in the body section of the webform and it works:

var _elqQ = _elqQ || [];
_elqQ.push(["elqSetSiteId", "xxxxxxxxxx"]);
_elqQ.push(["elqTrackPageView"]);
(function() {
function a() {
var b = document.createElement("script");
b.type = "text/javascript";
b.async = !0;
b.src = "//img.en25.com/i/elqCfg.min.js";
var a = document.getElementsByTagName("script")[0];
a.parentNode.insertBefore(b, a)
}
window.addEventListener ? window.addEventListener("DOMContentLoaded", a, !1) : window.attachEvent && window.attachEvent("onload", a)
})();

var timerId = null, timeout = 5;
function WaitUntilCustomerGUIDIsRetrieved() {
if(timerId) {
if(0 == timeout) {
return
}
if("function" === typeof this.GetElqCustomerGUID) {
//do something
return
}
timeout -= 1
}
timerId = setTimeout("WaitUntilCustomerGUIDIsRetrieved()", 500)
}
window.onload = WaitUntilCustomerGUIDIsRetrieved;
_elqQ.push(["elqGetCustomerGUID"]);

drupalninja99’s picture

So my patch didn't work? When I tested it in chrome inspector it looked like it was populating the GUID correctly on form submission.

drupalninja99’s picture

Status: Active » Closed (fixed)
FileSize
21.23 KB

I think the js I have is already doing this, see my screenshot. I just tested this again.