MARKETPLACE
PLUGINS
GOOGLE ANALYTICS 4 SINGLE PAGE APPS
Google Analytics 4 Single Page Apps logo

Google Analytics 4 Single Page Apps

Published March 2021
   •    Updated December 2025

Plugin details

Send virtual page views to Google Analytics. (+ user properties  + custom events + all the off the shelf GA functionality).
Send to multiple GA measurement Ids. You might want to do this so that your Application Users can have their own GA data.

Manage your GDPR compliance by;
- setting GA Off on page load and then enable in a workflow (opt-in) (eg after your User has given consent to collect their usage data) or
- setting GA on by default and then disable in a workflow (opt-out).
- Using Termly to manage your consent and opt in/out banner

With Bubble you can very easily create great Single Page Applications - but these do not work well with Google Analytics as only one page is ever loaded.  This plugin solves that problem.

See how-to videos & best practices explaining how to setup in your Bubble App & how to use your GA reports - https://ga4-page-view-demo.bubbleapps.io/version-test

Provides convenient actions in your workflows for GA events.  

Virtual page views
Login and set the GA user-id as the Bubble user unique id.
Signups
Login
Exception
Timing Complete
User properties
(I add to these as I find new ones I need in my own apps)

Also an element for easily seeing the page referrer.

Single page load apps and GA is explained here.
https://developers.google.com/analytics/devguides/collection/gtagjs/single-page-applications

A Single Page Application (SPA) is a web application or website that loads all of the resources required to navigate throughout the site on the first page load. As the user clicks links and interacts with the page, subsequent content is loaded dynamically. Another full page request is never made.

The default Google Analytics tag works well with traditional websites because the snippet code is run every single time the users load a new page. However, for a single page application where the site loads new page content dynamically rather than as full page loads, the analytics.js or gtag.js snippet code only runs once. This means subsequent (virtual) pageviews must be captured manually as new content is loaded.

This is what this plugin solves.

If you've purchased this plugin I'd really like to make sure that I get this working properly for you. The plugin price includes support needed to get you up and running. 


DM me in the Bubble forum to get in touch.

Youtube Video channel with for detailed explanations - https://www.youtube.com/playlist?list=PLpZXz2W3mS472Rly3pKJd0INLAenRvQKi

lindsay_knowcode



I've over 50 plugins in the Market Place - all my plugins come with reasonable support to get you up and running.

I am the creator of Plan B - Backups for Bubble Apps. https://planbbackups.io

I create plugins for complex integrations.

Flow Charts - Business diagrams in Bubble
https://bubble.io/plugin/flow-charts-1673968620785x258403360966967300

Adobe PDF - with commentings and annotating
https://bubble.io/plugin/adobe-pdf---with-commenting-1633396514551x410372775588659200

Etsy -
https://bubble.io/plugin/etsy-integration-1703292143599x255798298638549000

Square ACH and Embedded Cards
https://bubble.io/plugin/square-embedded-card--ach-1654618927193x637538826809245700

SSH & SFTP
https://bubble.io/plugin/ssh--sftp-commands-1684859796824x533713044810760200

Almighty dropzone - upload to GCS, Backblaze, Wasabi, AWS ... and more
https://bubble.io/plugin/upload-gcs-backblaze-wasabi-+++-1648644338633x187011566245249020

Postmark - for templates
https://bubble.io/plugin/postmark-template-1639362726262x203274658985279500

Google Sheets Get/Insert/Update
https://bubble.io/plugin/google-sheet-get-insert--update-1663938003776x932115872220446700

I do a suite of realtime Speech & Audio processing plugins;

Deepgram - realtime speeach to text with diarization
https://bubble.io/plugin/deepgram-realtime-transcription-1676726070867x623253573730041900

Speechmatics - realtime voice translation
https://bubble.io/plugin/speechmatics---realtime-translation-1701815413039x813343498074587100

ElevenLabs - realtime synthetic voices
https://bubble.io/plugin/elevenlabs-streaming-text-to-voice-1678812542328x297771263648333800

AssemblyAI - realtime voice to text
https://bubble.io/plugin/assemblyai-realtime-transcription-1666200218972x408222199372578800

Audo Recorder Pausible - with a beautiful visualisation
https://bubble.io/plugin/audio-recorder-pausable-1684661794734x134627875732586500

$36

One time  •  Or  $4/mo

5.0 stars   •   5 ratings
294 installs  
This plugin does not collect or track your personal data.

Platform

Web & Native mobile

Contributor details

Lindsay - Knowcode logo
Lindsay - Knowcode
Joined 2020   •   58 Plugins
View contributor profile

Instructions

First enter your Google Analytics measurement ID in the settings in the plugin settings. A measurement id starts with a 'g' - like g-1234567 The older Google older universal analytics tracking starts with 'ua-'.  Both will work.  All events will go to this measurement-id, in your workflows you can optionally add additional measurement id's
Then add into your workflows one of the actions: eg page views, and events. You can find these actions under analytics in the actions options in your workflows.  You will find actions prefixed GA....

Page views - adds page changes within a single page application. Use for example when within the application a user clicks a menu item, or a popup.   Use this when ever a user navigates through your SPA.

Having got this in place, you have basic GA working in your SPA.

Now get more advanced use out of your Google Analytics ....

User - adds variables as dimensions to your Google analytics, eg "Role", "Customer". Typically use then when a user logs in, or enters into a specific state, eg "gold customer". Do this in your login, and on a page load workflows. You will need to log into GA and add/declare these dimensions in order for them to be captured in your GA reports.

Events - add specific events to your Google Analytics, eg "Video played", "purchase made", "Registration complete". Typically use this as a goal in Google Analytics. Go into you GA dashboard and mark the relevnt ones of these as "conversions".

Send events and open a new window - What this does is make sure events are sent to GA _before_ you navigate away from the window. If you do the normal Bubble method of 2 actions in a workflow of "send GA" then "navigate away" the browser cancels that GA events being sent (all and any javascript processing) once the browser navigates away, and the event won't be captured in GA.

Optionally add an extra measurement id if you want to configure multiple Google Analytics accounts. See the video explainer in the demonstration app to understand that more.

GDPR, Opt-in and Opt-out to GA for your Users
In the plugin settings is 'GA Disable'. If set to 'true' then GA is disabled until you invoke the workflow action "GA Enable". Use this when you want your Bubble Users to opt-in to GA data collection.

Pro tip On a page load action, or on a login action add a "user" event and add some dimensions to your GA reports.

Best practices?  I've put some together on the service page - http://ga4-page-view-demo.bubbleapps.io/version-test/index

Setup at Google There is nothing special you need to do on the Google side (eg some people talk about a technique using tag rewriting in Google Tag Manager). Don't do this! If you want to know how to set up basic  Google Analytics for a Bubble app - watch Gaby's great video https://www.youtube.com/watch?v=1PgBtofjIDo

You only need to go into your GA dashboard to set up your user properties as "dimensions" and your relevant events as "conversions".

See the service page for videos on how to do this more advanced setup.

Youtube Video channel with for detailed explanations - https://www.youtube.com/playlist?list=PLpZXz2W3mS472Rly3pKJd0INLAenRvQKi

lindsay_knowcode


Types

This plugin can be found under the following types:
Api   •   Action   •   Background Services   •   Element

Categories

This plugin can be found under the following categories:

Resources

Support contact
Documentation
Tutorial

Rating and reviews

Average rating (5.0)

Worked wonders
October 5th, 2023
This plugin is amazing, it brings simplicity to the chaos of GA4 for Single Page Apps. It has been a game-changer for my setup, making tracking and analyzing data a breeze. Highly recommended!
Thank you for those nice words. They mean a lot. (plugin author)
November 11th, 2024
  •  
Lindsay - Knowcode
Great support from developer
March 14th, 2022
The developer helped me through my setup issues.
Awesome Plugin and Developer
September 7th, 2021
Great for people who want to use GA4. The developer is also great to work with should you have any questions or feedback about the plugin.
Thank you - any questions or improvements for the App or the Documentation I can make let me know. (plugin author)
September 7th, 2021
  •  
Lindsay - Knowcode
Awesome Plugin
May 26th, 2021
The plugin does exactly what I needed. Setup was smooth, and the support is excellent. Clearly done with professionalism and experience in Google Analytics. Thank you, Sidney
Thank you Sidney, glad to help get you up and running. Get in touch if any issues. Lindsay (plugin author)
May 29th, 2021
  •  
Lindsay - Knowcode
Perfect for giving Google Analytics access to users
April 28th, 2021
So many apps are focused on providing their own internal analytics to users but this plugin makes it so much simpler by just letting users connect their own Google Analytics tracking IDs to the pages they want to track.
Thank you, appreciate the feedback. That was the original purpose of this plugin, but it has grown a lot from there! (plugin author)
May 29th, 2021
  •  
Lindsay - Knowcode
Bubble