Hiya all no code/low code bubble creators/developers,
I want to use viral-loops on my bubble website and I want to show a widget to show the share link, a widget to track progress, a widget to show milestones and a social sharing widget on my custom designed dashboard. I have gone through the campaign setup and enabled all those widgets and entered my website and specific pages on it and have added the script to my dashboard page, which is named ai_dashboard_1 and I want to use or show those widgets on it (the script is shown in the attached image below and even thought the script is on a referral sign up page, I am using the same script on both the ai_dashboard_1 and the referral sign up page, named referral), and I have used the initialization code, which is shown in the attached image below for both of those pages in bubbleâs workflow to load that code after the page has loaded. The initialization code contains a dynamic value, shown in blue color and it gets the currently logged in userâs email to pass it to the code to initialize it. I have verified that the variable correctly stores a userâs email address and it is not empty by adding using console logs to the code and checking them in the console of those two pages. I have added a HTML element to my dashboard page with the widget code mentioned on this link- https://developers.viral-loops.com/docs/ under âform widget installationâ for each of those widgets I mentioned, but I am currently using only the referral url widget, which is shown in the attached image below. Despite setting up everything this way and following that campaign setup on your dashboard and adding that widget HTML code and script on those pages, nothing shows up in the HTML element with the referral url widget in the editor and on the live website. I have tried using incognito mode, deleting cookies, refreshing the dashboard page and checking if the person who is logged in is the same person who has beed added to my participant list and I have tried adding the script only to my bubbleâs dashboard of my website to the header and removed the script on those two pages, and after trying that, the HTML element with the referral url widget code was still empty in the editor and in the live website and nothing showed up.
I have also tried wrapping the initialization code in the â.onloadâ function and other similar ones, which is shown below in case the page was not fully loaded and removed that workflow I mentioned but the HTML element with the referral url widget was empty in the builder and on the live website.
window.onload = function() {
var userEmail = 'Current User\'s email'; // Insert Bubble dynamic data here
if (window.ViralLoops) {
ViralLoops.getCampaign()
.then(campaign => campaign.identify({ email: userEmail }))
.catch(error => console.error(error));
} else {
console.error("ViralLoops library not loaded");
}
};
Here is the code that I have also tried but I constantly kept getting the âViralLoops not ready, retrying in 500msâŚâ message and viral loops was never ready or initialized and I used this in the bubbleâs workflow in the âRun custom JSâ plugin after the page is loaded node:
function initializeViralLoops() {
var userEmail = 'Current User's email'; //dynamic value to get the user's email
console.log("BEFORE INITIALIZATION"+userEmail);
if (typeof window.ViralLoops !== 'undefined' && window.ViralLoops) {
window.ViralLoops.getCampaign()
.then(campaign => campaign.identify({ email: userEmail }))
.then(() => {
console.log('ViralLoops initialized successfully for:', userEmail);
})
.catch(error => {
console.error('ViralLoops initialization error:', error);
});
} else {
console.log('ViralLoops not ready, retrying in 500ms...');
setTimeout(initializeViralLoops, 500);
}
}
// Start initialization after a short delay to ensure DOM is ready
setTimeout(initializeViralLoops, 1000);
Page header script in page name referral (which is the same on the dashboard page like I said before):
Initialization code in the workflow:
Referral url widget HTML code:
What can I do to make the widgets work correctly on my bubble website?




