Bubble and Google Analytics 4

Hi Lindsay - does this offer still stand? would be incredibly grateful and thankful for your hard work in making this process easier

Hi @stefanof

I’m searching how to push to dataLayer the user slug.

I tried to insert this code in the header, just after the script that links GTM and Bubble.
But it doesn’t work.

Do you have an idea ?

Thank you in advance for your help


I am also trying to sort this out.

Hello guys, I believe this can solve the dataLayer.push() issue.
1 - You can either use the snippets provided by Google or use a plugin (in my case I used the GA4 + Tagmanager by apptastic (GA4 + Tag Manager Plugin | Bubble)
2.a- to send the datalayer push you can use the “Send Data To GTM” (use the ‘event’ Key with your GTM triggering event

2.b - to enable ecommerce you need to send the “purchase” event and the action in the plugin doesn’t allow to add arrays. So you can use a Run javascript (from toolbox)

Teste in the debug mode (Tag manager) to see whether the purchase event appear after your bubble action.


'event': 'purchase',
'ecommerce': {
'purchase': {
'actionField': {
'id': '12345',
'affiliation': 'rufy.com.br',
'revenue': '50.00',
'tax': '2.50',
'shipping': '5.00',
'coupon': 'rufybrazil'
'products': [{
'name': 'Product 1',
'id': 'P12345',
'price': '25.00',
'brand': 'Brand',
'category': 'subscription',
'variant': 'Red',
'quantity': 1
      }, {
'name': 'Product 2',
'id': 'P67890',
'price': '25.00',
'brand': 'Example Brand',
'category': 'Example Category',
'variant': 'Blue',
'quantity': 1
1 Like