Support

Home Forums Event Espresso Premium Include Google Analytics Ecommerce tracking

Include Google Analytics Ecommerce tracking

Posted: May 24, 2018 at 7:55 am


Kursus-Kompagniet.dk

May 24, 2018 at 7:55 am

I am trying to add Google Analytics Ecommerce tracking to my Event Espresso site.

I want to include pretty much the same data as in the example in the bottom of this page: https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce#loadit

How do i get the variables as registration amount, which products the customer bought, and so on? Which php files do i have to investigate further, to solve this?


Josh

  • Support Staff

May 24, 2018 at 4:02 pm

One file you could investigate is the thank-you-page-registration-details.template.php template, and another is the thank-you-page-transaction-details.template.php.

https://github.com/eventespresso/event-espresso-core/blob/master/shortcodes/espresso_thank_you/templates/thank-you-page-registration-details.template.php

https://github.com/eventespresso/event-espresso-core/blob/master/shortcodes/espresso_thank_you/templates/thank-you-page-transaction-details.template.php

The former displays information about the registrations, the latter information about the transaction. Each of those templates has at least one hook that exposes registration/transaction data. The hooks allow extending what happens on the page via your own custom PHP and JavaScript.

AHEE__thank_you_page_registration_details_template__after_registration_table_row

AHEE__thank_you_page_transaction_details_template__after_transaction_table_row

For example the following code added to your plugin will output some debug data about the transaction for development purposes:

add_action(
    'AHEE__thank_you_page_transaction_details_template__after_transaction_table_row', 
    'my_get_transaction_data_debug', 
    10, 
    1 
);
function my_get_transaction_data_debug( $transaction ) {
    echo '<div><pre>';

        var_dump($transaction);

    echo '</pre></div>';
}

The support post ‘Include Google Analytics Ecommerce tracking’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: closed

Updated by  Josh 12 months ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!