You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
override fun onComplete(isHomePageEnabled: Boolean, homePageDataSource: TBLHomePageDataSource) {
47
+
// Save recommendations to your data structure
48
+
}
49
+
override fun onFailure(error: String) {
50
+
// Handle the failure
51
+
}
52
+
});
53
+
`
42
54
43
55
### Swap Articles
44
56
45
-
To swap articles with content from Taboola,
46
-
call the `shouldSwapItemInSection` function in your OnBind methd to get the swapped item's content.
47
-
It returns True if the item was swapped, False if it wasn't.
57
+
- Home page Swapping approach:
58
+
59
+
To swap articles with content from Taboola,
60
+
call the `shouldSwapItemInSection` function in your OnBind methd to get the swapped item's content.
61
+
It returns True if the item was swapped, False if it wasn't.
48
62
49
63
50
64
public boolean shouldSwapItemInSection(
@@ -56,20 +70,54 @@ It returns True if the item was swapped, False if it wasn't.
56
70
@Nullable final ImageView thumbnailView,
57
71
@Nullable AdditionalViews additionalViews)
58
72
59
-
The parameters you need to pass in are:
60
-
- linePosition: of the cell
61
-
- sectionName: representing section
62
-
- lineView: view of the cell
63
-
- titleView: UI element representing the title of the cell
64
-
- contentView: UI element representing the description of the cell
65
-
- thumbnailView: UI element representing the image of the cell
66
-
- additionalView(optional): UI element representing the all other view in the lineView which aren’t mandatory
73
+
The parameters you need to pass in are:
74
+
- linePosition: of the cell
75
+
- sectionName: representing section
76
+
- lineView: view of the cell
77
+
- titleView: UI element representing the title of the cell
78
+
- contentView: UI element representing the description of the cell
79
+
- thumbnailView: UI element representing the image of the cell
80
+
- additionalView(optional): UI element representing the all other view in the lineView which aren’t mandatory
81
+
82
+
- Home page Data API approach:
83
+
84
+
Invoke `shouldSwapItemInSectionDataApi` for every item in your list after receiving the
85
+
recommendations (and only if the home page is enabled).
86
+
Invoking this method for all of your items (including those that will not be swapped) is necessary
87
+
for Taboola to maintain an accurate map of sections and positions.
88
+
The boolean value returned by `shouldSwapItemInSectionDataApi` (true or false) indicates whether
89
+
the item should be swapped:
90
+
If `true`: Replace the current list item with the available item from Toboola's recommendations list.
91
+
If `false`: Invoke addClickUrlForDuplicationCheck to allow Taboola to track if this item is duplicated elsewhere on the homepage.
92
+
93
+
public boolean shouldSwapItemInSectionDataApi(
94
+
String sectionName,
95
+
int linePosition,
96
+
int sectionStartPosition)
97
+
98
+
The parameters you need to pass in are:
99
+
- sectionName: representing section
100
+
- linePosition: of the cell
101
+
- sectionStartPosition: position of the first item in the section
67
102
68
103
#### How does the swapping take place?
69
-
When you call `shouldSwapItemInSection`, Taboola verifies that this item is allowed to be swapped and validates the fields of the content, then performs a swap with a recommendation.
70
-
Taboola will handle the views the publisher desires to swap.
71
-
It will validate the fields of the content and the swapped content as well.
72
-
After a successful validation - Taboola will swap the publisher’s content with Taboola recommendations, and return a boolean that indicates if the swapping process did occur.
104
+
105
+
- Home page Swapping approach:
106
+
107
+
When you call `shouldSwapItemInSection`, Taboola verifies that this item is allowed to be swapped and validates the fields of the content, then performs a swap with a recommendation.
108
+
Taboola will handle the views the publisher desires to swap.
109
+
It will validate the fields of the content and the swapped content as well.
110
+
After a successful validation - Taboola will swap the publisher’s content with Taboola recommendations, and return a boolean that indicates if the swapping process did occur.
111
+
112
+
- Home page Data API approach:
113
+
114
+
After calling `shouldSwapItemInSectionDataApi`, you must report the result calling `reportSwapDataApi'
115
+
116
+
If swap succeeds: Pass `true` for `itemHasBeenSwapped`
0 commit comments