Shlomi
Shlomi

Reputation: 3792

Google Analytics 4 and hitCallback

Previously with Universal Google Analytics i used sometimes the option to send hitCallback function when tracking custom events:

ga('send', {
    hitType: 'event',
    eventCategory: 'Some Category',
    eventAction: 'Some Action',
    eventLabel: 'Some Label',
    eventValue: 'Some Value',
    hitCallback() {
        console.log('event sent for sure!');
    }

});

this gave me the ability to ensure the event has been tracked in case i have redirection to another page afterwards.

I'm trying to find a way to do it with Google Analytics 4 but cannot find a standard parameter to send to gtag('event' ...) that will do the same.

It is crutial as from my experience many events are lost due to redirection especiually important ones like register or login.

Upvotes: 3

Views: 2125

Answers (1)

Shlomi
Shlomi

Reputation: 3792

Somehow after few hours of search i found it very quick after posting this one, so instead of deleting it it might be helpful for others.

The parameter it event_callback you can read more about it here:

https://developers.google.com/tag-platform/gtagjs/reference/parameters

Upvotes: 5

Related Questions