I'm using the webform module to... create webforms! But the GA code isn't sowing up on the confirmation pages. ie. I submit the form, and am taken to a page which shows my thank you message - this page has no GA code on it.

Comments

hass’s picture

Title: Gogole analytics code doesn't appear on webform confirmation pages » Google analytics code doesn't appear on webform confirmation pages
Category: bug » support
Status: Active » Fixed

Are you able to verify if the confirmation page may be excluded by the standard path exclusion filters (for e.g. "node/*/*"? You could also post the confirmation page URL and I'm able to verify this. If this is the case you need to alter the GA path exclusion settings more specific to your site.

mrfelton’s picture

I think I know why...

in _googleanalytics_visibility_pages, you do:

        $path = drupal_get_path_alias($_GET['q']);
        // Compare with the internal and path alias (if any).
        $page_match = drupal_match_path($path, $pages);
        if ($path != $_GET['q']) {
          $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
        }
        // When $visibility has a value of 0, the block is displayed on
        // all pages except those listed in $pages. When set to 1, it
        // is displayed only on those pages listed in $pages.
        $page_match = !($visibility xor $page_match);

I have my exclude paths set to:

admin
admin/*
user/*/*
node/add*
node/*/*
imce*

My confirmation page has an alias set, which does not match any of the above, so $page_match = drupal_match_path($path, $pages) works out to be FALSE.
However, drupal_match_path($_GET['q'], $pages); works out to be TRUE, since a webform confirmation page has a url where $_GET['q'] = 'node/12345/done.

I have node/*/* set in my exclude path, as I don't want node admin pages included (I think this is a fairly standard setting?).

so:
$page_match = $page_match || drupal_match_path($_GET['q'], $pages);

returns true, because the match based on $_GET['q'] returns true...

perhaps, it should only check $_GET['q'] if there is no alias?

mrfelton’s picture

Status: Fixed » Needs review
StatusFileSize
new811 bytes

How about this...

mrfelton’s picture

StatusFileSize
new834 bytes

reworded code comment to make it clearer what it's doing.

hass’s picture

No, you need to change the setting - not the code.

Replace the exclusion filter

node/*/*

with:

node/*/edit
node/*/track
node/*/outline
node/*/[other paths you don't like to see in the statistics]
mrfelton’s picture

Status: Needs review » Fixed

what is the reason for running the path match twice, once on the alias, and then again on the internal path?

EDIT: I mean, if I have set an alias for the node, then that is how the node will be accessed, and I should be able to write my exclude rules based on the aliases I have set. No?

hass’s picture

This has been taken over from core block visibility... cannot remember why in a few seconds, but it have a use case.

Status: Fixed » Closed (fixed)

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