©2011 Google -
Code Home -
Site Terms of Service -
Privacy Policy -
Site Directory
Google Code offered in:
English -
Español -
日本語 -
한국어 -
Português -
Pусский -
中文(简体) -
中文(繁體)
SUMMARY: PROPERTY | METHOD DETAIL: PROPERTY | METHOD
Defines an object that can be ranked based on the user's click statistics.
To create a rankable item, use the ranking
method
createRankableItem()
:
var rankItem = google.pers.ranking.createRankableItem();
Before you use a rankable item,
you must set its
identifier (identifier
) and
profile
(updateRankingProfile()
).
For details and sample code, see the
Personalization API
Developer Guide.
Each rankable item has four attributes, the values of which are used when items are ranked. For details, see Attributes that Affect Ranking.
See also:
google.pers.ranking
object
identifier
incrementClicksAndUpdateClickedTime(num_clicks)
rankType(flag)
resetStatistics()
updateAttributeValue(name, value)
updateItemOpenDuration(start_duration)
updateRankingProfile(data_source_id, user_profile)
object identifier
incrementClicksAndUpdateClickedTime(num_clicks)
integer num_clicks
- The number of clicks to increment by
rankType(flag)
integer flag
- A constant defined by contentRankingFlag
—
for example, contentRankingFlag.AlwaysBottom
resetStatistics()
updateAttributeValue(name, value)
string name
- The name of the attribute, such as "LastClickedTime";
a full list of attributes is in
Attributes
that Affect Ranking
object value
- The new value of the attribute
updateItemOpenDuration(start_duration)
false
,
this method updates the "ItemOpenDuration" attribute of the item
with the amount of time that has passed
since the method was most recently invoked
with an argument value of true
.
To update the duration, invoke this method twice, as shown in the following example.
//When opening the item: updateItemOpenDuration(true); ... //When closing the item: updateItemOpenDuration(false);
boolean start_duration
- Specify true
to indicate that the item is open;
specify false
to indicate that the item is closed
updateRankingProfile(data_source_id, user_profile)
integer data_source_id
- An arbitrary integer used to identify the source of the data associated with this item
object user_profile
- An object returned by the
createProfile()
method of google.pers.ranking
;
all items in the same gadget should use the same profile object