BuzzScreen JS Extension SDK Usage
Introduction
Please refer to the sample included in the SDK before applying to your app. - Github Link
Extension JS SDK Workflow
This extension SDK helps publishers to work with BuzzScreen SDK Basic Usagearchived which shows personalized contents and ads on Android lockscreen.
In order to use personalization features in BuzzScreen, user information is required. Using this SDK, the information can be passed from publisher's website to BuzzScreen app with simple integration.
This guide explains how to apply JS SDK to publisher's website.
Please discuss with your account manager before proceeding.
Index
Getting started
1. Sign in and point accumulation request flow
What the publisher needs to do is marked in blue in the table below.
1 | When a user tries to login by clicking a sign-in button on the BuzzScreen Android client, publisher's web frontend opens via WebView and is shown to the user. |
2 | The user attempts to sign in from the web frontend on the WebView. |
3 | The publisher's web frontend receives the user information and passes it to the publisher's server. |
4 | When the user is successfully signed-in, publisher's server forwards the session information to the web frontend. |
5 | The publisher's web frontend confirms that the user has signed in and calls the BuzzScreen Extension JS SDK function to pass user information. |
6 | BuzzScreen Extension JS SDK passes user information to Android client through Javascript Interface provided by Android. This information is then passed to the BuzzScreen server, which allows the Android client to serve contents and ads. |
7 | The Android client uses the BuzzScreen SDK to communicate with the BuzzScreen server upon user action such as landing or unlock. |
8 | The BuzzScreen server passes the userId and point information to the publisher's server to indicate how many points the particular user should receive. |
9 | The publisher's server receives the above information and gives points to the user. |
2. Publisher's task
What the publisher needs to do is marked in blue in the diagram above.
Content | Detail | |
---|---|---|
1 | Sign-in integration | If a user is successfully signed in from the publisher's website, this sdk should be used to pass user information to BuzzScreen SDK. This is explained in detail in the rest of this guide. |
2 | Postback integration | Publisher's server needs to be integrated with Buzzscreen server in order to give points to users for valid user action. Please refer to Reward Accumulation Postback APIarchived. |
Basic Usage - Sign-in integration
For the sign-in integration, the publisher should inform Buzzvil of the sign-in verification URL. Also SDK integration is required on result pages for both users who has signed in successfully and who hasn't.
1. Sign-in verification URL
Content | Detail |
---|---|
Sign-in verification URL | URL required to check whether the user has signed in or not
|
A. For user who has signed in |
|
B. For user who has not signed in |
|
For example, suppose that https://www.buzzvil.com/profile
is a sign-in verification URL.
When a user who already signed in accesses this address, a page with the account information of the user will be shown (indicated as personal page in the above diagram). On this page, SDK should be loaded and
Buzzscreen.notifySignedIn()
should be called in order to pass the user information to BuzzScreen.On the other hand, when a user who hasn't signed in accesses this address, a login page asking for Id and password is shown (indicated as login page). On this page, SDK should be loaded and
Buzzscreen.notifyNotSignedIn()
should be called in order to notify BuzzScreen that user is not signed in.
2. How to integrate JS SDK
1) Insert SDK
Insert this SDK on each of the two pages accessible by the "Sign-in verification URL".
<script src="buzzscreen-extension-0.0.2.js"></script>
2) Notify "signed in"
On personal page from the above diagram (the page shown when the user has signed in), call the following JavaScript code to pass the user information (user ID, year of birth, gender and extra data) and to notify BuzzScreen.
<script>
BuzzScreen.notifySignedIn('userId', 1990, BuzzScreen.GENDER_MALE, '{"key1":"value1","key2":"value2"}');
BuzzScreen.notifySignedIn('userId', 1990, BuzzScreen.GENDER_FEMALE, '{"key1":"value1","key2":"value2"}');
</script>
The type of each argument is
string
,number
,string
,string
in that order.Please take extra caution not to use wrong argument types.
If the arguments are set incorrectly, error logs are left in the console window.
In case where users' birthYear, gender and extra information is not available, the following code can be called instead.
<script>
BuzzScreen.notifySignedIn('userId');
</script>
3) Notify "not signed in"
On login page (the page shwon when not-signed-in user access the verification url), call the following JavaScript code:
Advanced Usage
Functions for SDK configuration convenience