Group widget

With this widget, you can advertise your group on Odnoklassniki. It will allow your website’s visitors to join literally in one click.

Your group should be open for joining.

Widget constructor

Widget settings

Group ID
Width
Height
Type

Result

Code to insert

How to get the ID of group

  1. You must be an administrator of the group.
  2. Go to your group’s page.
  3. Left under the avatar group in the menu there is an option “Settings.” Select it.
  4. At the bottom of the page that appears find the label “Group id: “.
  5. Copy the ID and paste it into the widget embed code.

Group join event tracking

After a group join via widget postMessage with following data will be sent to your page:

ok_join$__okGroup1

You can track event on page with widget by the following javascript code:

function listenForJoin() {
    if (window.addEventListener) {
        window.addEventListener('message', onJoin, false);
    } else {
        window.attachEvent('onmessage', onJoin);
    }
}

function onJoin(e) {
    var args = e.data.split("$");
    if (args[0] == "ok_join") {
        alert(args[1]);
    }
}

listenForJoin();