LogoLogo
Release notesHomepageTry demo
  • Welcome to the B2COPY knowledge base
  • Admin guide
    • Sign-in and 2FA
    • General interface overview
    • Configure B2COPY
      • Configure copy-trading and MAM settings
      • Configure PAMM settings
      • Configure Web UI settings
        • Show on Leaderboard
        • Show on Statistics page
        • Show on Trading Report
        • Fee settings
        • Subscription settings
        • Risk Ratio settings (applicable for copy trading only)
        • Account Properties
      • Configure account settings
        • Account settings
        • Default Master’s Positions Visibility
        • Default Investor’s Positions Visibility (applicable for PAMM only)
      • Configure access settings (only for a standalone solution)
      • Configure deposit and withdrawal settings (only for a standalone solution)
      • Configure the performance fee calculation settings
      • Configure the management fee calculation settings
      • Configure symbol mapping
      • Configure the trade fee filter
      • Configure B2COPY widgets
      • Prevent syncing of collapsed MetaTrader trading history with B2COPY
      • Copy positions to investment accounts with master account prices
      • Link open positions
      • Enable clients to select account groups when creating master and investment accounts in the Web UI
      • Run the Introducing Brokers (IB) program
        • Manage IB levels
        • Customize the IB partnership settings of investment accounts
      • Allocate custom rewards for assistance in managing master accounts
      • Use email templates to notify clients about important events
    • Register new Back Office users
      • Disable 2FA for Back Office users
    • Register new clients
      • Register new clients with email addresses
      • Register new clients with MT account logins (only for a standalone solution)
      • Add a profile picture and nickname to a client profile
    • Manage master and investment accounts
      • Create a master account
      • Set the default allocation parameters for a copy-trading or MAM master account
      • Set the allocation method and rollover settings for a PAMM master account
      • Create fee plans for a master account
      • Modify the default fee plan for a master account
      • Assign risk limits to a master account
      • Determine if risk limits are assigned to a master account
      • Assign a minimum deposit to a master account
      • Assign a subscription code to a master account
      • Set up a promo offer for a master account
      • View and execute pending PAMM requests on master accounts
      • Cancel pending PAMM requests on investment accounts
      • Create an investment account
      • Archive master and investment accounts
      • View information about archived accounts
      • Restore archived accounts
    • Manage trading robots
    • Manage subscriptions
      • Create a copy-trading or MAM subscription
      • Create a PAMM subscription
      • Assign a risk limit to a subscription
      • Modify a subscription
      • Resync open positions on a master account with subscribed investment accounts
      • Change a fee plan for an existing subscription
      • Initialize instant fee payments for subscriptions
      • View details about fees paid for a subscription
      • Pause and resume subscriptions
      • Terminate or reactivate a subscription
    • Manage deposits and withdrawals
      • Deposit funds to copy-trading and MAM accounts
      • Withdraw funds from copy-trading and MAM accounts
      • Deposit funds to PAMM accounts
      • Withdraw funds from PAMM accounts
  • User guide
    • Sign-in and 2FA
    • Account details
      • Subscriptions page
      • Trading Report page
      • Statistics page
      • Settings page
      • Requests page (for PAMM accounts only)
      • Fee Payments page
    • Use the Leaderboard to find the best-performing master accounts
    • Manage master and investment accounts
      • Create a master account
      • Set up or modify a fee plan for your master account
      • Change your master account visibility on the Leaderboard
      • Assign a subscription code to your master account
      • Assign a minimum deposit to your master account
      • Set up a promo offer for your master account
      • View and update rollover settings of your PAMM master account
      • Create an investment account
      • Add your profile picture and nickname
      • Add or change your account name
      • Reset your account password
    • Manage subscriptions
      • Create a subscription
      • Create a subscription using a subscription code
      • Create a subscription using a promo code
      • Change a risk ratio and allocation method for a subscription
      • Assign a risk limit to a subscription
      • Enable or disable the reverse copy option for a subscription
      • Check a fee plan applied to a subscription
      • Detach open positions copied into investment accounts
      • Pause or resume a subscription
      • Terminate and reactivate a subscription
    • Manage deposits and withdrawals
      • Deposit funds to your copy-trading and MAM accounts
      • Withdraw funds from your copy-trading and MAM accounts
      • Deposit funds to your PAMM accounts
      • Withdraw funds from your PAMM accounts
  • Copy-trading, PAMM, and MAM concepts
    • General comparison of copy-trading PAMM and MAM accounts
    • Allocation methods for copy trading and MAM
    • Allocation methods for PAMM
      • Reallocation on deposit and withdrawal
      • No action on deposit and autocorrection on withdrawal
    • Fee list
    • Return calculation
    • Drawdown and Maximum drawdown calculation
    • Risk limits for investors
    • Risk limits for master traders
    • Score calculation
  • API Documentation
    • Authorization in the Back Office
    • Get a list of master and investment accounts
    • Create a master or investment account using the existing MT account
    • Get data for the Statistics widget
    • Get data for the Leaderboard widget
    • Seamless authorization (only for a standalone solution)
    • Register a client and create their payment account (only for a standalone solution)
  • Video tutorials
  • Key terms
  • Release notes
Powered by GitBook
On this page
  • Leaderboard widget
  • The <iframe> code for the Leaderboard widget
  • Account Statistics widget
  • The <iframe> code for the Account Statistics widget
  • Obtain INVESTMENT_PLATFORM_ID

Was this helpful?

  1. Admin guide
  2. Configure B2COPY

Configure B2COPY widgets

Learn how to embed the Leaderboard and Account Statistics widgets on your website using HTML <iframe> and JavaScript for seamless interaction

PreviousConfigure the trade fee filterNextPrevent syncing of collapsed MetaTrader trading history with B2COPY

Last updated 6 days ago

Was this helpful?

This document describes how to embed the Leaderboard and Account Statistics widgets on your website.

Clients can find a list of top-performing master accounts in the Leaderboard widget displayed on your website. In the widget, they click a selected account to view the account trading information in the Account Statistics widget. If a client is satisfied with the trading results of the selected account and wants to subscribe to that account, the client clicks the +Follow button and is redirected to the Web UI Sign In page or any other landing page to which you want your client to be navigated.

The widgets are embedded in a web page using the HTML <iframe> element.

In addition to <iframe>, the scripts provided in the examples below are required to ensure proper interaction between both widgets. The scripts must also be added to the web pages in which the <iframe> elements containing the widgets are embedded.

Leaderboard widget

The following code should be inserted in the <head> element of a web page:

<head>
 <script>
  const ACCOUNT_STATISTICS_LANDING_URL = 'https://statistics.example.com'; 
  const INVESTMENT_PLATFORM_ID = 1;
  const PLATFORM = 'b2copy'; // 'b2copy' | 'mam' | 'pamm'

  window.addEventListener('message', event => {
    if (typeof event.data !== 'string') {
      return;
    }
    const {type: eventType, payload} = JSON.parse(event.data);

    if (eventType === 'LEADERBOARD_WIDGET_LOAD_COMPLETE') {
      const leaderboardWidgetConfigParams = {
        type: 'LEADERBOARD_WIDGET_CONFIG_PARAMS',
        payload: {
          investmentPlatformId: INVESTMENT_PLATFORM_ID,
          platform: PLATFORM,
        },
      };

      const url = document.getElementsByTagName('iframe')[0].src;
      event.source.postMessage(JSON.stringify(leaderboardWidgetConfigParams), url);
    }

    if (eventType === 'LEADERBOARD_WIDGET_ACCOUNT_ID') {
      const url = new URL(ACCOUNT_STATISTICS_LANDING_URL);
      url.searchParams.append('accountId', payload.accountId);

      window.open(url, '_blank');
    }
  });
 </script>
</head>

where:

  • ACCOUNT_STATISTICS_LANDING_URL — the address of a page containing the Account Statistics widget.

  • If you have only one platform configured, the identifier of your platform is 1.

  • PLATFORM — the type of platform. Possible values:

    • b2copy — for copy trading

    • mam — for MAM

    • pamm — for PAMM

The <iframe> code for the Leaderboard widget

The following code should be inserted in the <body> element of a web page:

<body>
 <iframe src="https://example.com/leaderboard"></iframe>
</body>

where:

https://example.com/leaderboard — must be replaced with the address of a web page containing the Leaderboard widget.

Account Statistics widget

The following code should be inserted in the <head> element of a web page:

<head>
 <script>
  const ACCOUNT_STATISTICS_WIDGET_CDN_URL = 'https://statistics.example.com';
  const ACCOUNT_STATISTICS_WIDGET_FOLLOW_LINK = 'https://example.com/en/trading-platform/';
  const INVESTMENT_PLATFORM_ID = 1;
  const PLATFORM = 'b2copy'; // 'b2copy' | 'mam' | 'pamm'

  window.addEventListener('message', event => {
   const {type: eventType} = JSON.parse(event.data);

   if (eventType === 'ACCOUNT_STATISTICS_WIDGET_LOAD_COMPLETE') {
    const url = new URL(window.location);
    const accountId = url.searchParams.get('accountId');

    const accountIdEventData = {
     type: 'ACCOUNT_STATISTICS_WIDGET_ACCOUNT_ID',
     payload: {accountId},
    };

    const investmentPlatformIdEventData = {
     type: 'ACCOUNT_STATISTICS_WIDGET_INVESTMENT_PLATFORM_ID',
     payload: {investmentPlatformId: INVESTMENT_PLATFORM_ID},
    }

    const followLinkEventData = {
     type: 'ACCOUNT_STATISTICS_WIDGET_FOLLOW_LINK',
     payload: {linkUrl: ACCOUNT_STATISTICS_WIDGET_FOLLOW_LINK},
    };

    const platformData = {
     type: 'ACCOUNT_STATISTICS_WIDGET_PLATFORM',
     payload: {platform: PLATFORM}
    };

    event.source.postMessage(JSON.stringify(accountIdEventData), ACCOUNT_STATISTICS_WIDGET_CDN_URL);
    event.source.postMessage(JSON.stringify(investmentPlatformIdEventData), ACCOUNT_STATISTICS_WIDGET_CDN_URL);
    event.source.postMessage(JSON.stringify(followLinkEventData), ACCOUNT_STATISTICS_WIDGET_CDN_URL);
    event.source.postMessage(JSON.stringify(platformData), ACCOUNT_STATISTICS_WIDGET_CDN_URL);
   }
  });
 </script>
</head>

where:

  • ACCOUNT_STATISTICS_WIDGET_CDN_URL — the address of a web page containing the Account Statistics widget.

  • ACCOUNT_STATISTICS_WIDGET_FOLLOW_LINK — the address of a web page that is opened after clicking the Follow button.

  • If you have only one platform configured, the identifier of your platform is 1.

  • PLATFORM — the type of platform. Possible values:

    • b2copy — for copy trading

    • mam — for MAM

    • pamm — for PAMM

The <iframe> code for the Account Statistics widget

The following code should be inserted in the <body> element of a web page:

<body>
 <iframe src="https://statistics.example.com"></iframe>
</body>

where:

https://statistics.example.com — must be replaced with the address of a web page containing the Account Statistics widget.

Obtain INVESTMENT_PLATFORM_ID

1

In the Back Office, go to Investment Platform > Platform Manager.

2

Click the Edit button located in the desired platform row.

The INVESTMENT_PLATFORM_ID is the last number of the platform URL (in the example below, INVESTMENT_PLATFORM_ID is 11).

INVESTMENT_PLATFORM_ID — the identifier of the investment platform instance (such as for MT4, MT5, and so on). For details, refer to .

INVESTMENT_PLATFORM_ID — the identifier of the investment platform instance (such as for MT4, MT5, and so on). For details, refer to .

Obtain INVESTMENT_PLATFORM_ID
Obtain INVESTMENT_PLATFORM_ID
Demo page with embedded widgets
Platform Manager
The investment platform ID in the URL
Platform Manager
The investment platform ID in the URL