Hei guys just a quick one,
I d need to send a custom event from bubble to GTM that will in turn send it to GA4 with a Javascript action in the workflow?
How can i do it?
Hei guys just a quick one,
I d need to send a custom event from bubble to GTM that will in turn send it to GA4 with a Javascript action in the workflow?
How can i do it?
To send a custom event from Bubble to Google Tag Manager (GTM) and then to Google Analytics 4 (GA4), you can use a JavaScript action in your Bubble workflow. Here are the steps you can follow:
var dataLayer = window.dataLayer || [];
dataLayer.push({
'event': 'CUSTOM_EVENT_NAME',
'gtm.start': new Date().getTime(),
'event_callback': function() {
document.location = 'REDIRECT_URL';
},
'gtm.containerId': 'GTM_CONTAINER_ID'
});
This code pushes a custom event to the GTM data layer when the JavaScript action is run. The “event” parameter specifies the name of the event, and the “event_callback” parameter is an optional function that can be used to perform additional actions after the event is pushed (such as redirecting the user to another page). Replace “REDIRECT_URL” with the URL you want to redirect the user to after the event is pushed.
That’s it! When the JavaScript action is run, it will push a custom event to the GTM data layer, which will in turn trigger the GA4 tag you set up earlier and send the data to your GA4 property.
Hei man @williamtisdale
thanks a lot to clarify the doubt So I ve tried like that but seems to not work… I don’t have a Redirect Url (I m not sure i got the point there…)
Have a look of my setting:
Am i wrong somewhere according to you?
My bad I don t know why but it was not working. Now it is.
So all good thank you man
You can remove the redirect URL part of the code if you don’t use it. I can confirm that everything works as expected.
This topic was automatically closed after 70 days. New replies are no longer allowed.