Content widget

Only public content is supported with this widget at the moment. You group must be open for joining. User’s profile must be public

With this widget, you can advertise any content of your group / profile on Odnoklassniki.

Following content types are available for sharing by a direct link:

  • group and user topics;
  • group and user photos.

Any other type of content (i.e. video, music) must be posted as a topic first.

Widget constructor




Result

Code to insert

Group join event tracking

If you publish any group content with this widget users can join your group via it. After a join a postMessage with following data is sent to your page:

ok_join$__okContent1

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();

User subscription event tracking

If you publish any user content with this widget other users can subscribe to you via it. After a subscription a postMessage with following data is sent to your page:

ok_subscribe$__okContent1

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

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

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

listenForJoin();