Closed Bug 999468 Opened 6 years ago Closed 6 years ago

[tracker] Let Android snippets be weighted like desktop (aka bug 925882)

Categories

(Snippets :: Service, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: deb, Unassigned)

References

Details

We're hoping to use snippets to drive user survey work for the User Advocacy team, but we want to restrict the number of people who see each survey to avoid survey-fatigue and basically annoying our users.
The desktop implementation defines the following 7 weights:

SNIPPET_WEIGHTS = ((33, 'Appear 1/3rd as often as an average snippet'),
                   (50, 'Appear half as often as an average snippet'),
                   (66, 'Appear 2/3rds as often as an average snippet'),
                   (100, 'Appear as often as an average snippet'),
                   (150, 'Appear 1.5 times as often as an average snippet'),
                   (200, 'Appear twice as often as an average snippet'),
                   (300, 'Appear three times as often as an average snippet'))

and the default value for a snippet is 100.
We feed this information to the client and the client decides when to display what. 


To fix this bug we need to:

 * Add the same weight attribute to JSON (Fennec) Snippets
 * Update the served JSON to include this information. New JSON will have the following format:

{"url": "https://mozilla.org", 
 "text": "This is text message for snippet #1. Links to mozilla.org", 
 "target_geo": "US",  # optional 
 "id": 1, 
 "icon": "data:imag..."
 "weight": 100 }

 * 'weight' will be always present in JSON and will have a default value of 100
 * We need to update Fennec to support weights.
Per comment 1, I filed a new bug to track Snippet Service update.

Is there a bug for the Fennec update?
No longer depends on: 1001379
Summary: Let Android snippets be weighted like desktop (aka bug 925882) → [tracker] Let Android snippets be weighted like desktop (aka bug 925882)
In https://bugzilla.mozilla.org/show_bug.cgi?id=1001379#c2 I suggest we don't deploy this code until we have more information about the client-side work necessary to support it.
Depends on: 1002567
(In reply to Giorgos Logiotatidis [:giorgos] from comment #1)
> The desktop implementation defines the following 7 weights:
> 
> SNIPPET_WEIGHTS = ((33, 'Appear 1/3rd as often as an average snippet'),
>                    (50, 'Appear half as often as an average snippet'),
>                    (66, 'Appear 2/3rds as often as an average snippet'),
>                    (100, 'Appear as often as an average snippet'),
>                    (150, 'Appear 1.5 times as often as an average snippet'),
>                    (200, 'Appear twice as often as an average snippet'),
>                    (300, 'Appear three times as often as an average
> snippet'))
> 
> and the default value for a snippet is 100.
> We feed this information to the client and the client decides when to
> display what. 

I'm having trouble finding this logic in the desktop client code. Are you sure this is implemented on the client, and not on the server? Or is this part of the JS payload that's delivered to the desktop client?

I'm just looking for inspiration for how to implement bug 1002567.
(In reply to :Margaret Leibovic from comment #4)
> I'm having trouble finding this logic in the desktop client code. Are you
> sure this is implemented on the client, and not on the server? Or is this
> part of the JS payload that's delivered to the desktop client?
> 
> I'm just looking for inspiration for how to implement bug 1002567.

It's part of the JS payload: https://github.com/mozilla/snippets-service/blob/master/snippets/base/templates/base/includes/snippet_js.html#L119
Looks like this is resolved based on the two dependent bugs, feel free to reopen if I'm being too aggressive in closing. :D
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.