Support

Home Forums Event Espresso Premium Goal Tracking In Google Analytics

Goal Tracking In Google Analytics

Posted: October 5, 2018 at 6:48 am

Viewing 3 reply threads


Phil Evans

October 5, 2018 at 6:48 am

Hi,

We’re trying to set up goals in Google Analytics for events that are free, i.e. have no ticket price.

However, we want to assign a financial value in GA.

We have several different event types, each of which will have a different value.

Can we identify which course type is being booked so we can automatically assign those values in GA? The thank you URL looks like

https://xxxxxxxxxxx.com/thank-you/?e_reg_url_link=1-bdd69129c7f36398e1dda00913bd54e8

Thanks

Phil


Josh

  • Support Staff

October 5, 2018 at 8:20 am

Hi Phil,

Do you know what can be used to identify custom values using Google Analytics? The thank you page URL as it stands doesn’t include that information, so I wonder if Google Analytics can use a special URL parameter or a meta tag within the pages markup. If you can share a link to the GA documentation you’re following we can investigate further.


Phil Evans

October 5, 2018 at 9:36 am

This reply has been marked as private.


Josh

  • Support Staff

October 5, 2018 at 3:36 pm

No, however what you can do is use conditionally add some on page JavaScript (more info here: https://www.lunametrics.com/blog/2018/01/16/events-goals-google-analytics/#on-page-javascript)

So for example, you add this to your functions file:

function custom_thank_you_page_goal_tracking($transaction) {
    if ( $transaction instanceof EE_Transaction ) {
        foreach ( $transaction->registrations() as $registration ) {
            if ( $registration instanceof EE_Registration ) {
                $event = $registration->event();
                if ( $event instanceof EE_Event ) {
                    $category = $event->first_event_category();
                    if ( $category instanceof EE_Term ) {
                        $category_id = $category->id();
                        if($category_id == 78) {
                            echo '<script>ga("send", "event", "[category]", "[action]", "[label]", [value]);</script>';
                        }
                    }
                }
            }
        }   
    } 
}
add_action(
    'AHEE__thank_you_page_overview_template__bottom', 
    'custom_thank_you_page_goal_tracking'
);

and if the event has category 78 only, it will add the script for Google Analytics to the page.

Viewing 3 reply threads

The support post ‘Goal Tracking In Google Analytics’ 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.

Event Espresso