When the uc_googleanalytics.module is enabled, it should add the appropriate Google Analytics code to the footer of the page upon a successful checkout.

If the "Alternate checkout completion page:" option is used in the Checkout settings, this doesn't seem to work for url aliased completion pages.

Lines 69 - 74 of uc_googleanalytics.module (6.x-2.0) read as follows:

// Or if the URL is the custom completion page.
  $completion_page = variable_get('uc_cart_checkout_complete_page', '');

  if (!empty($completion_page) && $completion_page == $_GET['q']) {
    return TRUE;
  }

For a completion page stored as its url alias, this should compare the alias of $_GET['q'] with the 'uc_cart_checkout_complete_page variable, as follows

// Or if the URL is the custom completion page.
  $completion_page = variable_get('uc_cart_checkout_complete_page', '');

  if (!empty($completion_page) && $completion_page == drupal_get_path_alias($_GET['q'])) { 
    return TRUE;
  }

This is a small change, but it took me a while to figure out.

I just checked out the latest HEAD version, and while the code has changed somewhat, it still seems to compare the uc_cart_checkout_complete_page variable directly with $_GET['q'].

It's only a one liner, but I attach a patch against HEAD in case it is of use.

Hope this helps.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dbassendine’s picture

Version: 6.x-2.0 » 6.x-2.4

We've encountered this issue too, which still exists in 2.4. This patch provides an effective fix. Here's my +1 for including it in the next release.

Thanks, David

dbassendine’s picture

My apologies. This is still an issue in 2.4. However, the patch provided above does not apply successfully to the 2.4 version of uc_googleanalytics.module. I've attached an updated version below.

Thanks, David

TR’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, uc_googleanalytics-completion.patch, failed testing.

longwave’s picture

Status: Needs work » Fixed

Committed to both branches.

Status: Fixed » Closed (fixed)

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