Skip to content

Banner Mode: A Banner Where You Choose ​

Shows a RAKUFUN banner at a spot you choose on your page (for example the top of the page, or above the main content). When users click anywhere on the banner, the RAKUFUN product page opens in a new tab to complete the purchase.

When to use it: you want an entry that stands out more than a button.

The banner's content is fixed: the RAKUFUN icon, the text "RAKUFUN" and "日本代购服务" (Japan purchasing service), and a "立即购买" (Buy Now) button. The text is currently fixed in Chinese. The banner does not show the product's image, title, or price.

Live Demo ​

🎨 横幅模式实时演示

查看横向横幅如何渲染到容器中

横幅容器

SDK 会在此容器中渲染横向横幅

Integration Steps ​

Step 1: Add an empty div where you want the banner ​

html
<body>
    <!-- The banner appears here -->
    <div class="rakufun-sdk-embed-banner"></div>

    <div class="main-content">
        <h1>Product Details</h1>
        <!-- Your page content -->
    </div>
</body>

The class name must be rakufun-sdk-embed-banner. You can add more than one on the same page; a banner appears in each.

Step 2: Include the SDK, switch to banner mode, and set the product information ​

Put the following on the page, usually right before </body>:

html
<script src="https://sdk.rakufun.com/rakufun-universal.min.js"></script>
<script>
  // Switch to banner mode (without this line, the bottom panel is shown instead)
  rakufun.setUIMode('banner');

  // Tell the SDK which product this is (not shown on the banner, but passed to the RAKUFUN product page on click)
  rakufun.setUIProductData({
    url: window.location.href,                 // Address of the current product page
    title: 'PlayStation 5 Digital Edition',    // Product name
    price: '49980',                            // Price, digits only, no ¥ or commas
    images: ['https://example.com/ps5.jpg'],   // Product images, full addresses
    description: 'Next-gen console with ultra-fast loading'  // Product description (optional)
  });
</script>

For the other fields you can pass, see API Reference - Product Information Fields.

The banner's height depends on its content: about 74px on desktop. When the screen width is 768px or less (phones, etc.), the content is stacked vertically and the height is about 121px. Leave enough room for it where you place it.

FAQ ​

The banner doesn't show? ​

Check in this order:

  1. Are you testing from Japan? It's hidden by default for Japanese IPs. For testing, call rakufun.enableDebug() to show it temporarily, and remove it after testing
  2. Is the container's class name rakufun-sdk-embed-banner, with no typos?
  3. Is rakufun.setUIMode('banner') called?
  4. Open the browser console and check whether the SDK loaded and whether there are errors

Want to show a confirmation dialog after the click, before RAKUFUN opens? ​

Use setUICartHandler. The purchase continues only if the function returns true; any other value cancels it:

javascript
rakufun.setUICartHandler(async (product) => {
  return confirm(`Confirm purchase of ${product.title}?`);
});

Other Integration Options ​

  • Default Mode - Purchase panel shown automatically at the bottom of the page, the fastest integration
  • Button Mode - Shows a purchase button where you choose
  • Custom Mode - Use your own button

Questions? Contact us: service@rakufun.com

Released under the MIT License