Category: Widgets

Boost your app’s functionality and visibility with MobiLoud’s widgets

  • Testing widgets | vendrux Docs

    Testing widgets | vendrux Docs

    You will definitely want to test the widgets once you deploy them to your website, to make sure that everything works and looks as you want.

    Running these tests on real mobile devices can get overwhelming, so we recommend that you run your tests on your desktop browser.

    To do this, you will need to emulate a mobile device by adjusting your browser’s user agent. We recommend using the following Chrome extension to do this: User Agent Switcher and Manager

    Once you have installed the extension, set it up as follows:

    Step 1

    Select “Chrome” as the browser and “Android” as the platform if you want to test the Android version of the Button, or “Safari” and “iOS” in case you want to test the iOS version:

    Step 2

    Select one of the options that will appear, any will work:

    Step 3

    Click “Apply” to make sure the user agent is properly set up on your browser:

    Step 4

    You can now press “F5” while viewing your website to refresh the browser window with the updated user agent.

    Reset

    If you want to revert the changes to the user agent, as some websites might start behaving differently after doing so, you can click the “Reset” button:

  • Smart Banner | vendrux Docs

    Smart Banner | vendrux Docs

    We highly recommend promoting your app using smart app banners – with these you’ll show a banner suggesting to install your app only to your website visitors using either an iOS or an Android device.

    Read on to learn more about smart banners, and how to implement a smart app banner on your site.

    What Are Smart App Banners?

    ‘Smart App Banners’ are banners that show up when someone lands on your mobile website, prompting them to get your app.

    Here’s an example:

    Here’s what Apple’s own help pages say about smart app banners:

    “Smart App Banners vastly improve users’ browsing experience compared to other promotional methods. Users will trust that tapping the banner will take them to the App Store and not a third-party advertisement. They will appreciate that banners are presented unobtrusively at the top of a webpage, instead of as a full-screen ad interrupting the web content. And with a large and prominent close button, a banner is easy for users to dismiss. When the user returns to the webpage, the banner won’t reappear.”

    Features

    ML Smart Banner features:

    • Configuration options:
      • Banner position
      • Banner delay
      • Texts fonts
      • Texts color
      • Banner BG
      • Text content (for button and heading/description)
      • App icon (the same for Android and Ios)
      • Entering animation
      • Display options: On load or when user scrolls up/down
      • Android and iOS links
    • Native Apple Smart App Banner support on iOS Safari when the page already includes the required apple-itunes-app meta tag. If the tag exists, the custom banner is suppressed automatically
    • Button Link applies automatically depending on user agent: If Android, it uses the provided android link if iOS, uses the provided ios link.
    • deviceData method available: its a function that can be called to get the current browser OS, useful for triggering external functions’. It returns a string containing “android” | “ios” | “windows”
    • Fallback App Icon option –> If the provided icon link is invalid / or image can not be displayed, an icon is generated using the App Name Param and Button colors
    • Default options set (if not texts, images or colors provided, it shows placeholder info, useful for catching errors or for testing while implementing the banner)
    • Banner can be used as a module or used directly in an html / script tag
    • Code written in Typescript and minified/bundled with Vite

    How to use

    Smart Banner can be used importing the JS code via CDN or as a module using NPM

    With CDN

    Just copy & paste this code at the end of the tag in your site. Modify the values accordingly. You probably want to change the values for:

    • appName: 2 initials from your brand, this is a fallback for the app logo
    • buttonColor: An HEX value, a good idea is to use your brand’s primary color
    • iconUrl: Your app’s logo, you can go to the store page and right click in the logo and copy that image URL
    • textHeading / textDescription: Banner text content
    • linkIos / linkAndroid: the stores links, the banner will redirect the user to the correct store depending on their device
    script type="module" src="https://cdn.jsdelivr.net/npm/@vendrux/ml-smart-banner@latest/dist/ml-smart-banner.min.js">script>
    
    script>
    	const SBoptions = {
              fontFamily: `"Source Sans Pro", "Arial", sans-serif`, // (string) Font family for banner texts, defaults to system safe fonts
              fallbackFontFamily: 'sans-serif', // (string) Font family for fallback icon, safe options are serif and sans-serif
              appName: 'ML', // (string) Initials for fallback icon.  Recommended 2 characters. Fallback Image uses button text and bg color
              textColor: '#222', // (string) Banner texts color (any color property value)
              buttonColor: '#000000', // (string) Button color (any background property value)
              buttonText: 'Download', // (string) Button text
              buttonTextColor: '#fff', // (string) Button Text Color (any color property value)
              iconUrl: 'https://is1-ssl.mzstatic.com/image/thumb/Purple113/v4/c4/a1/70/c4a1704e-ed21-abde-cc5b-20c33be2c6a7/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/230x0w.webp', // (string) Icon url, defaults to avatar with appName. You can use the app logo in the appstore/playstore
              textHeading: 'Download our App!', // (string) Heading Text
              textDescription: 'Get it now, download today', // (string) Description text
              bannerColor: '#fff', // (string) Banner BG color
              linkIos: 'https://apps.apple.com', // (string) Link for iOS 
              linkAndroid: 'https://play.google.com', // (string) Link for Android 
              position: 'bottom', // (string) Position of the banner, default 'top'. 'top' | 'bottom'
              animation: 'fadeIn', // (string) Banner animation, default 'fadeIn'. 'fadeIn' | 'scaleUp' | 'slideBottom' | 'slideTop' | 'slideLeft' | 'slideRight' | null,
              display: 'onLoad', // (string) Display options, default 'onLoad'. 'onLoad' | 'onScrollDown' | 'onScrollUp'
              radius: '0', // (string) Banner radius with units
              delay: 0, // (number) defines how much time to wait until the element shows up
              shadow: true, // (boolean) If true applies soft shadow, true | false
              useSession: true, // (boolean) If true, after closed, Banner is not shown upon page reload. Default: true
              zindex: 999999 // (number) Sets the z-index of the element
    	}
    
    
      	function addSmartBanner() {
      	// only shows the banner in mobile devices & if not the app
    		if(!deviceData.isMobile || deviceData.isCanvas ){
    			return
    		}
        	new SmartBanner(SBoptions).init();
    	}
      	window.addEventListener('load', addSmartBanner);
    script>

    NPM 📦

    @vendrux/ml-smart-banner

    npm i @vendrux/ml-smart-banner

    Configuration options ⚙️

    const options = {
        fontFamily: `"Source Sans Pro", "Arial", sans-serif`, // (string) Font family for banner texts, defaults to system safe fonts
        fallbackFontFamily: 'sans-serif', // (string) Font family for fallback icon, safe options are serif and sans-serif
        appName: 'ML', // (string) Initials for fallback icon.  Recommended 2 characters. Fallback Image uses button text and bg color
        textColor: '#222', // (string) Banner texts color (any color property value)
        buttonColor: '#222', // (string) Button color (any background property value)
        buttonText: 'Download', // (string) Button text
        buttonTextColor: '#fff', // (string) Button Text Color (any color property value)
        iconUrl: '', // (string) Icon url, defaults to avatar with appName
        textHeading: 'Download now!', // (string) Heading Text
        textDescription: 'Try it now, download today', // (string) Description text
        bannerColor: '#fff', // (string) Banner BG color
        linkIos: 'https://itunes.apple.com/', // (string) Link for iOS 
        linkAndroid: 'https://play.google.com/', // (string) Link for Android 
        position: 'bottom', // (string) Position of the banner, default 'top'. 'top' | 'bottom'
        animation: 'fadeIn', // (string) Banner animation, default 'fadeIn'. 'fadeIn' | 'scaleUp' | 'slideBottom' | 'slideTop' | 'slideLeft' | 'slideRight' | null,
        display: 'onLoad', // (string) Display options, default 'onLoad'. 'onLoad' | 'onScrollDown' | 'onScrollUp'
        radius: '0', // (string) Banner radius with units
        delay: 0, // (number) defines how much time to wait until the element shows up
        shadow: true, // (boolean) If true applies soft shadow, true | false
        useSession: true, // (boolean) If true, after closed, Banner is not shown upon page reload. Default: true
        zindex: 999999 // (number) Sets the z-index of the element
    }
    
    const smartBanner = new SmartBanner(options);

    Methods 💡

    deviceData.os // returns current os "android" | "ios" | "windows" | "desktop"
    deviceData.isCanvas // returns true or false
    deviceData.isMobile // returns true or false
    deviceData.browser // returns "safari" | "chrome" | "firefox" | "other"
    deviceData.isIosSafari // returns true only for Safari on iPhone/iPad/iPod

    Apple native banner on iOS Safari, custom banner elsewhere

    If your page already includes Apple’s required meta tag in the server-rendered , the library automatically suppresses the custom banner on iOS Safari while still showing the custom banner on Android and non-Safari iOS browsers.

    "apple-itunes-app" content="app-id=123456789, app-argument=https://example.com/open">
    const options = {
      linkIos: 'https://apps.apple.com/app/id123456789',
      linkAndroid: 'https://play.google.com/store/apps/details?id=com.example.app'
    }
    
    if (deviceData.isMobile && !deviceData.isCanvas) {
      new SmartBanner(options).init();
    }

    Behavior:

    • iOS Safari + meta tag present: native Apple banner handles the experience and the custom banner is suppressed
    • iOS Safari + meta tag missing: custom banner is shown as a fallback
    • Android: custom banner is shown as usual
    • iOS Chrome/Firefox/other: custom banner is shown as usual

    Important note:

    • Apple documents Smart App Banners as a meta tag in the page head. For the most reliable results, render the meta tag in the original HTML when possible.

    Recipes 🍳

    This are useful ways to implement the widget. We always recommend using an Event Listener to trigger the code when the document is loaded window.addEventListener('load', fnName)

    Insert Smart Banner on mobile only

    function addSmartBanner() {
    	if(!deviceData.isMobile || deviceData.isCanvas ){
    		return
    	}
        new SmartBanner(options).init();
      }
    window.addEventListener('load', addSmartBanner);

    Using deviceData method to filter devices

    const options = {
      // Set params here
    }
    
    // Insert widgets only in our Canvas platform
    if(deviceData.isCanvas) {
    	const smartBanner = new SmartBanner(options).init();
    }
    
    // Apply specific configs based on OS
    if(deviceData.os === "android" || deviceData.os === "windows") {
      const smartBanner = new SmartBanner(options1).init();
    } 
    if(deviceData.os === "desktop" || deviceData.os === "ios") {
      const smartBanner = new SmartBanner(options2).init();
    }
    
    // Insert widgets only in Mobile userAgent
    if(deviceData.isMobile) {
    	const smartBanner = new SmartBanner(options3).init();
    }

    Events

    The library emits some useful events in the browser window, these can be used to trigger custom functions using event listeners.

    • BANNER_CLOSED: Triggered when close button is clicked, banner gets unmounted from page also.
    • BANNER_MOUNTED: Triggered when banner is mounted in page, on init() it gets unmounted as a cleanup and then mounted.
    • BANNER_UNMOUNTED: Triggered when banner is mounted in unmounted, this is triggered on close or when firing unmount(),
    • BANNER_LINK_CLICKED: Triggered when banner link is clicked
    • APPLE_NATIVE_BANNER_ACTIVE: Triggered when iOS Safari detects an existing apple-itunes-app meta tag and defers to Apple’s native banner

    Triggering events based on Smart Banner events

    window.addEventListener('BANNER_MOUNTED', () => {
      console.log('banner opened');
      // trigger something...
    });
    window.addEventListener('BANNER_CLOSED', () => {
      console.log('banner closed');
      // trigger something...
    });
    window.addEventListener('BANNER_UNMOUNTED', () => {
      console.log('banner unmounted');
      // trigger something...
    });
    window.addEventListener('BANNER_LINK_CLICKED', () => {
      console.log('banner link clicked');
      // trigger something...
    });

    Testing Widgets 🧪

    www.vendrux.com/docs/testing-widgets
  • App Download Redirect Guide | vendrux Docs

    App Download Redirect Guide | vendrux Docs

    App Download Redirect Guide | Vendrux Docs

  • QR Widget | vendrux Docs

    QR Widget | vendrux Docs

    The QR Code Widget allows you to promote app-specific features, and discounts, followed by a QR code that can be scanned to open your app install page on mobile devices.

    What Are QR Widgets?

    QR widgets are modals/popups that show up when someone lands on your desktop website, prompting them to get your app.

    Here’s an example:

    Features ✨

    ML QR Widget features:

    • Configuration options:
      • Widget position
      • Widget delay
      • Texts fonts
      • Texts color
      • Widget BG
      • QR colors
      • QR with images
      • Text content
      • Entering animation
      • Display options: On load or when user scrolls up/down
    • Fallback options –> If the provided icon link is invalid / or image can not be displayed, an icon is generated using the App Name Param and Button colors
    • Default options set (if not texts, images or colors provided, it shows placeholder info, useful for catching errors or for testing while implementing the widgets)
    • Widget can be used as a module or used directly in an html / script tag
    • The library uses QuickChart’s QR Library, methods from their API are available to use within the widget
    • Code written in Typescript and minified/bundled with Vite

    How to use 📖

    QR Widget can be used importing the JS code via CDN or as a module using NPM

    With CDN 🚀

    In order to install the QR Code Widget you will want to add the following piece of code into your website, before closing   tags:

      script type="module" src="https://cdn.jsdelivr.net/npm/@vendrux/ml-qr-widget@latest/dist/ml-qr-widget.min.js">script>
      script>
        function addQrWidget() {
          new QrWidget().init();
        }
        window.addEventListener('load', addQrWidget);
      script>

    NPM 📦

    @vendrux/ml-qr-widget

    npm i @vendrux/ml-qr-widget

    Configuration options ⚙️

    To learn options available within qrOptions param, reference this: QuickChart’s QR Library,

    const options = {
       fontFamily: `"Source Sans Pro", "Arial", sans-serif`, // (string) Font family for widgets texts, defaults to system safe fonts
          textColor: '#222', // (string) Widget texts color (any color property value)
          textHeading: 'Get 10% OFF using Vendrux app', // (string) Heading Text
          textDescription: 'Scan our QR to download the app on your device and unlock the discount', // (string) Description text
          widgetsColor: '#fff', // (string) Widget BG color
          backDrop: true,// (boolean) if true, adds a backdop in front of the page
          backDropZIndex: 888888, // (number) z-index of the backdrop, should be lower than widgets z-index
          qrOptions: { // Params for the QR Generation, uses params from this docs: https://quickchart.io/documentation/qr-codes/
            text: "https://redirect.vendrux.com/?ios=https://itunes.apple.com/",
            size: 150,
            margin: 0
          },     
          position: 'center', // (string) Position of the widgets, default 'center'. 'center' | 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right'
          animation: 'fadeIn', // (string) Widget animation, default 'fadeIn'. 'fadeIn' | 'scaleUp' | 'slideBottom' | 'slideTop' | 'slideLeft' | 'slideRight' | null,
          display: 'onLoad', // (string) Display options, default 'onLoad'. 'onLoad' | 'onScrollDown' | 'onScrollUp'
          radius: '10px', // (string) Widget radius with CSS units
          delay: 0, // (number) defines how much time to wait until the element shows up
          shadow: true, // (boolean) If true applies soft shadow, true | false
          useSession: false, // (boolean) If true, after widgets is closed, it creates a session registry to hide widgets on page reloads until the end of user's session
          zindex: 999999, // (number) Widget z-index
          maxWidth: "400px", // (string) Max Width of the widgets with CSS units
          sessionExpire: 1440 // (number) time for banner to show again in minutes starting from the time the banner is shown, defualt: 1440 (1 day)
       
        };
    
    
    const qrWidget = new QrWidget(options);

    Methods 💡

    deviceData.os // returns current os "android" | "ios" | "windows" | "desktop"
    deviceData.isCanvas // returns true or false
    deviceData.isMobile // returns true or false

    Recipes 🍳

    This are useful ways to implement the widget. We always recommend using an Event Listener to trigger the code when the document is loaded window.addEventListener('load', fnName)

    Insert QR Banner on desktop only

    function addQrWidget() {
    	if(deviceData.isMobile || deviceData.isCanvas ){
    		return
    	}
        new QrWidget(options).init();
      }
      window.addEventListener('load', addQrWidget);

    Using deviceData method to filter devices

    const options = {
      // Set params here
    }
    
    // Insert widgets only in our Canvas platform
    if(deviceData.isCanvas) {
    	const qrWidget = new QrWidget(options);
    }
    
    // Apply specific configs based on OS
    if(deviceData.os === "android" || deviceData.os === "windows") {
      const qrWidget = new QrWidget(options1); // different options sets can be passed for different platforms
    } 
    if(deviceData.os === "desktop" || deviceData.os === "ios") {
      const qrWidget = new QrWidget(options2);
    }
    
    // Insert widgets only in Mobile userAgent
    if(deviceData.isMobile) {
    	const qrWidget = new QrWidget(options3);
    }

    How Banner Session works

    When ‘useSession’ parameter is set to true, the banners appears once until the banner is closed, after closed, the banner won’t appear until the next day (default) or until the time configured in the ‘sessionExpire’ parameter, this parameter should have the time in minutes.

    1. If user closes the modal, it creates a LocalStorage key called “widgetClosed” with a date value (for example if we set up the sessionExpire value to 1440 (minutes), it would hide until tomorrow)

    2. On widget init(), the library checks if the param exists and if the date is bigger than current date

    3. If the expiration date already passed, the key is removed from storage and widget is shown again

    Redirect URL 🔗

    We provide a custom redirect URL that sends users to the correct app store using a single link.

    To use it, simply format the URL like this:

    https://redirect.vendrux.com/?ios=IOS_URL&android=ANDROID_URL

    Parameters:

    • ios: URL for iOS devices (e.g., App Store link)
    • android: URL for Android devices (e.g., Google Play link)
    • redirect: this performs a redirect to a new URL for every platform
    • buttonColor: this accepts an hex value (without the ‘#’)

    when the user open the redirect link on their phone, it will take them to the correct store like so:

    [Example] ios & android redirect:

    These parameters are used for automatically redirecting users to the correct store depending on their device.

    https://redirect.vendrux.com/?android=https://linkToPlaystore.com&ios=https://linkToAppStore.com

    [Example] redirect & button color:

    When a redirect to a new page is needed for every platform, the ?redirect parameter can be used along with ?buttonColor.

    https://redirect.vendrux.com/?redirect=https://shorturl.at/OWKx&buttonColor=00376e

    Testing Widgets 🧪

    www.vendrux.com/docs/testing-widgets
  • Promotions Banner | vendrux Docs

    Promotions Banner | vendrux Docs

    Our Promotions Banner widget will allow you to display a message when your website gets displayed inside the apps, so you can provide exclusive app offers to your users.

    Here’s an example:

    Features ✨

    ML Promotions Banner features:

    • Configuration options:
      • Banner position
      • Banner delay
      • Texts fonts
      • Texts color
      • Banner BG
      • Text content
      • Entering animation
      • Display options: On load or when user scrolls up/down
      • Android and iOS links
    • Button Link applies automatically depending on user agent: If Android, it uses the provided android link if iOS, uses the provided ios link.
    • deviceData method available: its a function that can be called to get the current browser OS, useful for triggering external functions’. It returns a string containing “android” | “ios” | “windows”
    • Default options set (if not texts, images or colors provided, it shows placeholder info, useful for catching errors or for testing while implementing the banner)
    • Banner can be used as a module or used directly in an html / script tag
    • Code written in Typescript and minified/bundled with Vite

    How to use 📖

    Promotions Banner can be used importing the JS code via CDN or as a module using NPM

    With CDN 🚀

    script type="module" src="https://cdn.jsdelivr.net/npm/@vendrux/ml-promotions-banner@latest/dist/ml-promotions-banner.min.js">script>
    script>
      function addPromotionsBanner() {
        new PromotionsBanner().init();
      }
      window.addEventListener('load', addPromotionsBanner);
    script>

    NPM 📦

    @vendrux/ml-promotions-banner

    npm i @vendrux/ml-promotions-banner

    Configuration options ⚙️

    const options = {
          fontFamily: `"Source Sans Pro", "Arial", sans-serif`, // Font family for banner texts, defaults to system safe fonts
          textColor: '#222', // Banner texts color (any color property value),
          textHeading: 'Get a discount on your first purchase', // Heading Text
          textDescription: 'Use coupon 10OFF', // Description text
          bannerColor: 'white', // Banner BG color
          link: '#', // Link for button
          position: 'top', // Position of the banner, default 'top'. 'top' | 'bottom'
          animation: 'fadeIn', // Banner animation, default 'fadeIn'. 'fadeIn' | 'scaleUp' | 'slideBottom' | 'slideTop' | 'slideLeft' | 'slideRight' | null,
          display: 'onLoad', // Display options, default 'onLoad'. 'onLoad' | 'onScrollDown' | 'onScrollUp'
          radius: '0', // Banner radius with units
          delay: 0, // defines how much time to wait until the element shows up in ms
          shadow: true, // If true applies soft shadow, true | false
          useSession: false,
          zindex: 9999999
    }
    
    const promotionsBanner = new PromotionsBanner(options);

    Methods 💡

    deviceData.os // returns current os "android" | "ios" | "windows" | "desktop"
    deviceData.isCanvas // returns true or false
    deviceData.isMobile // returns true or false

    Recipes 🍳

    This are useful ways to implement the widget

    const options = {
          fontFamily: `"Source Sans Pro", "Arial", sans-serif`, // Font family for banner texts, defaults to system safe fonts
          textColor: '#222', // Banner texts color (any color property value),
          textHeading: 'Get a discount on your first purchase', // Heading Text
          textDescription: 'Use coupon 10OFF', // Description text
          bannerColor: 'white', // Banner BG color
          link: '#', // Link for button
          position: 'top', // Position of the banner, default 'top'. 'top' | 'bottom'
          animation: 'fadeIn', // Banner animation, default 'fadeIn'. 'fadeIn' | 'scaleUp' | 'slideBottom' | 'slideTop' | 'slideLeft' | 'slideRight' | null,
          display: 'onLoad', // Display options, default 'onLoad'. 'onLoad' | 'onScrollDown' | 'onScrollUp'
          radius: '0', // Banner radius with units
          delay: 0, // defines how much time to wait until the element shows up in ms
          shadow: true, // If true applies soft shadow, true | false
          useSession: false,
          zindex: 9999999
    }
    
    // Insert banner only in our Canvas platform
    if(deviceData.isCanvas) {
    	const promotionsBanner = new PromotionsBanner(options);
    }
    
    // Apply specific configs based on OS
    if(deviceData.os === "android" || deviceData.os === "windows") {
      const promotionsBanner = new PromotionsBanner({link: 'https://linkOne.com'});
    } 
    if(deviceData.os === "desktop" || deviceData.os === "ios") {
      const promotionsBanner = new PromotionsBanner({link: 'https://linkTwo.com'});
    }
    
    // Insert banner only in Mobile userAgent
    if(deviceData.isMobile) {
    	const promotionsBanner = new PromotionsBanner(options);
    }

    Using a “copy text” function for coupons

    
    // Set banner text with an onclick function in it
    const options = {
          textDescription: `Please use code 10OFF for 10% off in your next order!`
    }
    
    // Create the copyBannerText function that is linked to the description text, it copies the text, displays a "Copied!" message in that place and then shows the passed text again	
    function copyBannerText(e, text){
    	navigator.clipboard.writeText(text);
    	e.textContent = "Copied!"
    	setTimeout( function() {
          e.textContent = text
        }, 3000);
    }
    
    
      function addPromotionsBanner() {
    // Here we can use the deviceData method to display the banner only on desired devices
    		new PromotionsBanner(options).init();
      }
    
      window.addEventListener('load', addPromotionsBanner);

    Testing Widgets 🧪

    www.vendrux.com/docs/testing-widgets
  • Popup Widget | vendrux Docs

    Popup Widget | vendrux Docs

    The ML Popup Widget makes it easy to prompt users with a native-style popup when their app version is outdated. This keeps your user base on the latest, most secure version of your app.

    By effectively utilizing update popups, you can drive app engagement, improve user satisfaction, and ultimately increase your app’s success.

    This element can also be used as a normal popup to add a custom UI ele

    ment and a different experience in your app.

    What This Widget Does

    The widget checks the user’s app version and displays a popup only if it’s older than your defined minimum version. This works inside mobile apps or webviews, and uses native-feeling styling that resembles iOS or Android prompts.

    It also works as a normal popup to provide your users a nice User Experience.

    The popup includes:

    • A custom heading, description, and CTA button
    • Links to the relevant App Store / Play Store
    • Optional blurred backdrop, animations, and more
    • Conditional display based on app version

    Copy Directly Into Your Site 📄

    Paste the following code at the end of your page’s . This popup will show only when the user’s app version is older than your defined minimum version (minVersion), in this code we set the closable param to false, ensuring the popup is not dismissable. Full list of options at the end of this guide:

     src="">
    script>
      const popupOptions = {
        popupStyle: 'ios',
        fontFamily: `"Source Sans Pro", "Arial", sans-serif`,
        textColor: '#222',
        textHeading: 'Upgrade required',
        textDescription: 'This app is out of date, please visit store to upgrade to the latest version',
        buttonText: 'Download new version',
        buttonColor: '#000000',
        buttonTextColor: "#ffffff",
        widgetColor: '#fff',
        backDrop: true,
        backDropBlur: true,
        backDropZIndex: 888888,
        zIndex: 999999,
        position: 'center',
        animation: 'fadeIn',
        display: 'onLoad',
        radius: '10px',
        delay: 0,
        shadow: true,
        useSession: false,
        maxWidth: "700px",
        closable: false,
        padding: '20px',
        linkIos: 'https://itunes.apple.com/?PATH-TO-YOUR-APP',
        linkAndroid: '',
      };
    
      function addPopupWidget() {
      // Checks if current device is a phone  (deviceData.isMobile) and if its the app (deviceData.isCanvas)
        if (deviceData.isMobile || deviceData.isCanvas) {
          const minVersion = 1.0;
          // Gets current app version
          const appVersion = nativeFunctions.getDeviceInfo().appVersion;
          // Compares the minimum required version with the current app version
          // if appVersion 
          const isOutdated = deviceData.compareAppVersion(minVersion, appVersion);
    			
          if (isOutdated) {
          // Triggers the widget
            new PopupWidget(popupOptions).init();
          }
        }
      }
    
      window.addEventListener('load', addPopupWidget);
    script>

    Widget Methods

    The widget have the following methods to compare the current app version and to enable the widget in the app only:

    // returns true if its an ios or anroid device
    deviceData.isMobile
    
    // returns 'ios', 'android' or 'windows'
    deviceData.os
    
    // Returns true if using the app
    deviceData.isCanvas
    
    // Accepts two params (numbers)
    // if appVersion 
    
    deviceData.compareAppVersion(minVersion, appVersion)
    
    // CANVAS PLATFORM METHODS
    
    // Returns an object with app metadata and info
    nativeFunctions.getDeviceInfo()
    
    /*
    mobiloudAppInfo = {
    	appId = string,
    	appVersion = string,
    	brand = string,
    	hardware = string,
    	manufacturer = string,
    	model = string,
    	nameos = string,
    	osVersion = string,
    	platform = string,
    	pushSubscribed = bool,
    	pushToken = string,
    	pushUserId = string,
    	timeZone = string
    }
    */

    This function returns true if the current version is lower than the required minimum. It enables developers to show the popup only when needed, avoiding unnecessary prompts.

    Customization Options

    You can modify any value in popupOptions to match your app’s tone and design:

    • textHeading, textDescription, buttonText: Popup content
    • linkIos, linkAndroid: Deep link or store URL for each platform
    • popupStyle : This accepts ‘ios’ for  default ios styles or ‘android’ for custom CSS styles
    • position, animation, shadow, radius: Look and feel
    • closable: false: Disables the close (X) button to make the popup mandatory
    • useSession: false: Ensures popup shows every time until the app is updated

    Key points

    • Set a meaningful minimum version number whenever a critical update is released.
    • Always include store links for both platforms or ensure the popup is shown only in the desired platforms (this can be done using deviceData.os for getting the current device)
    • Match styling to your app’s branding for a consistent experience.
    • Make the popup non-dismissible (closable: false) if the update is required.

    Widget Options

  • Popup Widget | vendrux Docs

    Popup Widget | vendrux Docs

    The ML Popup Widget makes it easy to prompt users with a native-style popup when their app version is outdated. This keeps your user base on the latest, most secure version of your app.

    By effectively utilizing update popups, you can drive app engagement, improve user satisfaction, and ultimately increase your app’s success.

    This element can also be used as a normal popup to add a custom UI ele

    ment and a different experience in your app.

    What This Widget Does

    The widget checks the user’s app version and displays a popup only if it’s older than your defined minimum version. This works inside mobile apps or webviews, and uses native-feeling styling that resembles iOS or Android prompts.

    It also works as a normal popup to provide your users a nice User Experience.

    The popup includes:

    • A custom heading, description, and CTA button
    • Links to the relevant App Store / Play Store
    • Optional blurred backdrop, animations, and more
    • Conditional display based on app version

    Copy Directly Into Your Site 📄

    Paste the following code at the end of your page’s . This popup will show only when the user’s app version is older than your defined minimum version (minVersion), in this code we set the closable param to false, ensuring the popup is not dismissable. Full list of options at the end of this guide:

     src="">
    script>
      const popupOptions = {
        popupStyle: 'ios',
        fontFamily: `"Source Sans Pro", "Arial", sans-serif`,
        textColor: '#222',
        textHeading: 'Upgrade required',
        textDescription: 'This app is out of date, please visit store to upgrade to the latest version',
        buttonText: 'Download new version',
        buttonColor: '#000000',
        buttonTextColor: "#ffffff",
        widgetColor: '#fff',
        backDrop: true,
        backDropBlur: true,
        backDropZIndex: 888888,
        zIndex: 999999,
        position: 'center',
        animation: 'fadeIn',
        display: 'onLoad',
        radius: '10px',
        delay: 0,
        shadow: true,
        useSession: false,
        maxWidth: "700px",
        closable: false,
        padding: '20px',
        linkIos: 'https://itunes.apple.com/?PATH-TO-YOUR-APP',
        linkAndroid: '',
      };
    
      function addPopupWidget() {
      // Checks if current device is a phone  (deviceData.isMobile) and if its the app (deviceData.isCanvas)
        if (deviceData.isMobile || deviceData.isCanvas) {
          const minVersion = 1.0;
          // Gets current app version
          const appVersion = nativeFunctions.getDeviceInfo().appVersion;
          // Compares the minimum required version with the current app version
          // if appVersion 
          const isOutdated = deviceData.compareAppVersion(minVersion, appVersion);
    			
          if (isOutdated) {
          // Triggers the widget
            new PopupWidget(popupOptions).init();
          }
        }
      }
    
      window.addEventListener('load', addPopupWidget);
    script>

    Widget Methods

    The widget have the following methods to compare the current app version and to enable the widget in the app only:

    // returns true if its an ios or anroid device
    deviceData.isMobile
    
    // returns 'ios', 'android' or 'windows'
    deviceData.os
    
    // Returns true if using the app
    deviceData.isCanvas
    
    // Accepts two params (numbers)
    // if appVersion 
    
    deviceData.compareAppVersion(minVersion, appVersion)
    
    // CANVAS PLATFORM METHODS
    
    // Returns an object with app metadata and info
    nativeFunctions.getDeviceInfo()
    
    /*
    mobiloudAppInfo = {
    	appId = string,
    	appVersion = string,
    	brand = string,
    	hardware = string,
    	manufacturer = string,
    	model = string,
    	nameos = string,
    	osVersion = string,
    	platform = string,
    	pushSubscribed = bool,
    	pushToken = string,
    	pushUserId = string,
    	timeZone = string
    }
    */

    This function returns true if the current version is lower than the required minimum. It enables developers to show the popup only when needed, avoiding unnecessary prompts.

    Customization Options

    You can modify any value in popupOptions to match your app’s tone and design:

    • textHeading, textDescription, buttonText: Popup content
    • linkIos, linkAndroid: Deep link or store URL for each platform
    • popupStyle : This accepts ‘ios’ for  default ios styles or ‘android’ for custom CSS styles
    • position, animation, shadow, radius: Look and feel
    • closable: false: Disables the close (X) button to make the popup mandatory
    • useSession: false: Ensures popup shows every time until the app is updated

    Key points

    • Set a meaningful minimum version number whenever a critical update is released.
    • Always include store links for both platforms or ensure the popup is shown only in the desired platforms (this can be done using deviceData.os for getting the current device)
    • Match styling to your app’s branding for a consistent experience.
    • Make the popup non-dismissible (closable: false) if the update is required.

    Widget Options

  • CSS Injection Tool | vendrux Docs

    Introduction

    The Web-App Style Injector is a lightweight JavaScript library that simplifies the process of tailoring your website for web and app versions. By adding a few lines of code, you can apply distinct styles to elements visible only on the app version or hidden entirely on it. No advanced technical knowledge is required; it’s as simple as copy-pasting two script tags!

    Key Features

    1. Effortless Integration: Just copy and paste the provided script tags to get started.
    2. Dynamic Styling: Automatically adds a is-app class to the , enabling custom styles for app and web versions.
    3. App-Specific Classes:
      • app-hide: Hides elements exclusively on the app version.
      • app-exclusive: Displays elements only on the app version.
    4. Customizable Options: Use optional parameters for further flexibility, such as hiding predefined sections or disabling logs.
    5. Helper Logs: By default, helpful console logs guide you during setup and usage.
    6. Advanced Classes Injection: A developer-oriented feature that allows regex-based CSS injection for specific pages.

    How to Use It

    1. Basic Implementation

    For the simplest setup, follow these steps:

    Copy the following code and paste it right before the closing tag of your document

     defer>
    script>
      (function(){
          styleTemplate();
      })();
    script>


    With this setup, your website will Automatically add a is-app class to the

    when the site is navigated through the app, and enables custom styles for app and web versions.

    It also add some useful style rules to the document:

    The app-hide and app-exclusive classes provide simple ways to control the visibility of elements in the app version:

    • .app-hide: Hides certain elements in the app version of the site.
    • .app-exclusive: Displays certain elements only in the app version of the site.

    Here’s an example of how to use these classes in your HTML:

    class="app-hide">❌ Element not visible in app ❌

    div class="app-exclusive">📱 Element only visible in app 📱div>

    Define  styles in your stylesheet as you would normally do, like this:

    .elementClass {
        color: blue; /* Default for web */
    }
    body.is-app .elementClass {
        color: red; /* For app */
    }


    In this example, text will appear blue on the web version but red in the app version.

    2. Optional Parameters

    The library supports optional settings to enhance its functionality:

    • Logs: Enable or disable helper console logs.
    • Predefined Stylesheets: Automatically hide common sections in the app version (e.g., footers, banners, popups).

    Example of using optional parameters:

    (function(){
        styleTemplate({
            hideSections: ["hide-footers", "hide-banners"],
            logs: false
        });
    })();
    

    Available Predefined Stylesheets:

    • hide-footers: This hides the site's footer
    • hide-wp-adminbar: Hides WordPress adminbar, this usually shows after users sign in in a WordPress site
    • hide-back-to-top: This hides some floating back to top arrows/buttons
    • hide-popups-and-consents: This includes: cookie consent in bottom drawers, promotional popups, and enables overflow in the body, sometimes popups locks page scroll
    • hide-banners: This hides some promotional bars / banners that are above the site's header
    • hide-fabs: This hides Floating buttons (a lot of them added with plugins, so we include some common plugin selectors), this also hide some floating captcha elements

    By customizing the parameters, you can fine-tune the appearance of your app version with minimal effort.

    3. Advanced Classes Injection

    For developers, the library provides a powerful feature to inject CSS globally or selectively based on URL patterns using regular expressions. This allows precise control over styles for specific pages.

    Example implementation:

    >
    script>
    (function(){
        addStyle({css: `a{color: red !important}`});
        addStyle({css: `a{color: yellow !important}`, regex: /\/?param$/});
        addStyle({css: `a{color: green !important}`, regex: /.*/, name: "Global Styles"});
        addStyle({css: `a{color: green !important}`, regex: /.*/, name: "Global Styles", logs: true});
    })();
    script>

    You can define styles and target specific pages by passing a regex pattern. Here are some examples of how to use the configuration options:

    // Define styles as a string
    let style = `
      a {
        color: green;
        background-color: yellow;
      }
      .className {
        font-size: 2rem;
      }
    `;
    
    // Use regex to target specific pages
    let regex = /.*\/login/;
    
    // Name the style block (optional)
    let name = "Login Styles";
    
    // Enable logs for debugging (optional)
    addStyle({css: style, regex: regex, name: name, logs: true});
    
    // Apply global styles without regex
    addStyle({css: `color: red !important`});
    • css: The CSS rules as a string.
    • regex: A regular expression to target specific pages.
    • name: A name for the style block (optional).
    • logs: Enable or disable logs for debugging (optional).

    Device-Specific Methods

    • deviceData.os: Returns the current OS ("android", "ios", "windows", "desktop").
    • deviceData.isCanvas: Returns true or false.
    • deviceData.isMobile: Returns true or false.

    By combining these advanced features, you can achieve highly customized styling for specific scenarios.

    Mixing Methods

    The library allows you to combine the styleTemplate and addStyle methods for even greater flexibility. For example, you can use styleTemplate to apply predefined styles globally and then customize specific pages with addStyle:

    (function(){
        styleTemplate({hideSections: ["hide-footer"]});
        // Custom styles applied in canvas/app only
      if(deviceData.isCanvas){
        addStyle({css: ".customClass{color: red}", regex: /.*login/});
        addStyle({css: `a{color: yellow !important}`, regex: /\/?param$/});
        }
    })();
    

    This approach ensures a consistent base styling while allowing for precise page-level customizations.

  • Back Button | vendrux Docs

    Back Button | vendrux Docs

    A ‘Back Button’ in your app is essential for user experience, providing a quick and intuitive way to backtrack through a series of actions or views. Without a back button, users might feel disoriented or frustrated trying to navigate within the app.

    This library provides a web based widget that replicates the native look and feel provided by the iOS and Android SDKs. The purpose is to add navigation options to a web app when running in a native app container, like what Vendrux provides.

    Here’s an example:

    Features ✨

    ML Back Button features:

    • Configuration options:
      • Button text/label
      • Button colors
      • Position and animation
      • Display options: when user scrolls screen, on page load
      • Basic style settings, extensible with CSS
      • Options to replace elements and attach button to a container
      • Regex / url filtering, to avoid displaying the button in certain pages
    • deviceData method available: its a function that can be called to get the current browser OS, useful for triggering external functions’. It returns a string containing “android” | “ios” | “windows”
    • Default options set (if not texts, images or colors provided, it shows placeholder info, useful for catching errors or for testing while implementing the Button)
    • Button can be used as a module or used directly in an html / script tag
    • Code written in Typescript and minified/bundled with Vite

    How to use 📖

    ml-back-button can be used importing the JS code via CDN or as a module using NPM

    With CDN 🚀

    script type="module" src="https://cdn.jsdelivr.net/npm/@vendrux/ml-back-button@latest/dist/ml-back-button.min.js">script>
    script>
      function addBackButton() {
      	new BackButton().init();
      }
      window.addEventListener('load', addBackButton);
    script>

    NPM 📦

    @vendrux/ml-back-button

    npm i @vendrux/ml-back-button

    Configuration options ⚙️

    	const options = {
    /** Sets the button text color (if string is used in label); Example '#fff'*/
      textColor: string,
      /** Sets the button fill color (if svg is used in label); Example '#000'*/
      fillColor: string,
      /** Sets the button background color (if svg is used in label); Example '#000'*/
      buttonColorPrimary: string, 
      /** Sets the button label; Example 'Back', '...'*/
      label: string,
      /** Sets the button position when floating: 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right' */
      position: 'top-right' | 'top-left' | 'bottom-left' | 'bottom-right',
      /** Sets the button entrance animation: 'fadeIn' | 'scaleUp' | 'slideBottom' | 'slideTop' | 'slideLeft' | 'slideRight' | null */
      animation: 'fadeIn' | 'scaleUp' | 'slideBottom' | 'slideTop' | 'slideLeft' | 'slideRight' | null, 
      /** Sets the button display type: 'onLoad' | 'onScrollDown' | 'onScrollUp' */
      display: 'onLoad' | 'onScrollDown' | 'onScrollUp', 
      /** Sets the button radius: css unit, 50% gives a rounded btn if same height/width; Example '50%' */
      radius: string,
      /** Sets the button width: css unit; Example '20px' */
      width: string,
      /** Sets the button inner padding: css unit; Example '1em' */
      padding: string,
      /** Defines how much time to wait until the element shows up (in ms); Example 1000 */
      delay: number, 
      /** If not null, button is injected into a container, it uses any html selectors; Example '.class', '#id', null  */
      containerSelector: string | null, 
      /** If container selector activated, it places the button before or after other elements; Example 'first' | 'last' | null */
      containerOrder: 'first' | 'last' | null,
      /** Sets text alignment, button has a flex container; Example 'center' | 'start' | 'end' */
      textAlign: 'center' | 'start' | 'end',
      /** If true applies soft shadow; Boolean */
      shadow: boolean,
      /** if a selector is placed here, this element would be replaced with the back button; Example '.className' '#idName' */
      replaceElement:  string | null,
      /** uses regex to avoid injecting button in certain pages; Example /(?:\/|\/home|\/someUrl|\/about|\/categories\/clothing)/ */
      regex: string | null,
      /** Display or not logs, useful when developing; Boolean */
      logs: boolean  
    }
    
    const BackButton = new BackButton(options);

    Methods 💡

    deviceData.os // returns current os "android" | "ios" | "windows" | "desktop"
    deviceData.isCanvas // returns true or false
    deviceData.isMobile // returns true or false

    Recipes 🍳

    This are useful ways to implement the widget. We always recommend using an Event Listener to trigger the code when the document is loaded window.addEventListener('load', fnName)

    Insert Back Button – desktop only

    function addBackButton() {
    	if(deviceData.isMobile || deviceData.isCanvas ){
    		return
    	}
        new BackButton(options).init();
      }
    window.addEventListener('load', addBackButton);

    Using deviceData method to filter devices

    const options = {
      // Set params here
    }
    
    // Insert widgets only in our Canvas platform
    if(deviceData.isCanvas) {
    	const backButton = new BackButton(options);
    }
    
    // Apply specific configs based on OS
    if(deviceData.os === "android" || deviceData.os === "windows") {
      const backButton = new BackButton(options1);
    } 
    if(deviceData.os === "desktop" || deviceData.os === "ios") {
      const backButton = new BackButton(options2);
    }
    
    // Insert widgets only in Mobile userAgent
    if(deviceData.isMobile) {
    	const backButton = new BackButton(options3);
    }

    Testing Widgets 🧪

    www.vendrux.com/docs/testing-widgets