Google Analytics eCommerce Integration

1 reply [Last post]
benklocek
Offline
Joined: 07/30/2010
Status: 
Answered

Hi Leighton,

Any thoughts about the best way to integrate File Downloads Suite (or perhaps it's just ms_core) with Google Analytics eCommerce reporting?

My initial thought was just to put the JS on the thank you page, and load the proper data with:
$order = ms_core_order_load($_SESSION['ms_oid']);

but I thought there might be some hooks I could use to just put it in template.php and use public functions to load the data. I'd like to make iforward compatible as possible.

Thanks in advance,

./ben

Leighton Whiting
Offline
Joined: 06/02/2009
Ben, I added the custom

Ben,

I added the custom thank-you pages feature for things like this, so you are on the right track.

Essentially, since drupal_add_js doesn't work when placed before drupal_goto, it needs to placed directly on the page.

Of course, if you are using Drupal 7, you can use the spiffy new hook_page_build (http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...) to add in the js you need. But it would still need to be tweaked depending on if you are using custom thank you page paths instead of the default one, because of the drupal_goto

If you come up with a different solution or idea, let me know :)

-Leighton

Twitter Feed