[tracker] Create JSON snippets endpoint for Firefox for Android

RESOLVED FIXED

Status

Snippets
Service
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: Margaret, Unassigned)

Tracking

(Depends on: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
Hopefully I'm filing this request in the right place!

For Firefox for Android, we're planning to ship a bundled add-on that shows promotional messages in a banner on about:home. We want the data that backs these messages to be powered by the existing snippets service, but our add-on expects JSON data from the server, not HTML.

We'd like this JSON to just be an array of different message objects, each of which contain text/url/icon properties. I currently have a demo server running here:
http://snippets-server.paas.allizom.org/

See this blog post for some more background and a demo:
http://blog.margaretleibovic.com/post/62378620575/home-page-snippets-for-firefox-for-android
So, ignoring timelines (I CC'd the people who will ask those questions :P),
Ugh, whoops. Let me try that again.

So, ignoring timelines (I CC'd the people who will ask those questions :P), the most straightforward way to do this would be to add a new URL to snippets that delivers the JSON (just images and text, I assume?). We'd have to determine what info we want in the URL similar to how Desktop has a giant URL of parameters, and cache on that. 

Given that features like geolocation and interactive snippets are currently powered by JS that we serve, it'd just be image and text snippets, but honestly that makes my life easier. :D

As for who would manage this, jcollings manages the current desktop snippets, but we can add users to snippets that only have access to Android snippets if necessary.

Comment 3

4 years ago
Jean is ready to jump on the day-to-day management of this feature as soon as it rolls out.  Let us know how we can help (testing, etc).
We're just trying to understand the scope and feasibilty of this request. A couple questions:

* What are the external timeline drivers (if any) we should be aware of?
* Are you familiar with the current functionality of snippets on the client -- particularly with respect to localization, geolocation and metrics -- and will this architecture support them?
Flags: needinfo?(margaret.leibovic)
(Reporter)

Comment 5

4 years ago
(In reply to Justin Crawford [:hoosteeno] from comment #4)
> We're just trying to understand the scope and feasibilty of this request. A
> couple questions:
> 
> * What are the external timeline drivers (if any) we should be aware of?

Not that I know of. As I understand it, this is a service our product marketing folks would manage, so let's ask Jesse if he knows. Karen would also be a good person to ask about what exactly we want out of this feature, but she's on PTO until the end of next week.

> * Are you familiar with the current functionality of snippets on the client
> -- particularly with respect to localization, geolocation and metrics -- and
> will this architecture support them?

All I know it what I've read on this wiki page:
https://wiki.mozilla.org/Websites/Snippets/about:home_101

Right now my demo add-on does not take any of these things into account (it just makes a request to http://snippets-server.paas.allizom.org/ every time the add-on is loaded), but I can make changes to support whatever desktop currently supports.
Flags: needinfo?(margaret.leibovic) → needinfo?(jesse)

Comment 6

4 years ago
Hi everyone. There are no time drivers necessarily but this a huge missed opportunity for us that has been tabled for a while... so we're trying to get it live ASAP. It helps us get messages out to our userbase on a continuous basis every time they open our product. 

Also, please note that the content owner of this will be Jean Collings (jcollings@mozilla.com) who manages Snippets for Desktop as well.
Hope this helps.
Flags: needinfo?(jesse)
I totally agree that we're missing an opportunity here.

I'm also glad to hear that there isn't an external driver for a November release, because I'm not sure we could make it happen in time. Supporting this may be a medium-sized effort when all said and done, because...

* adding a few million new clients at once may necessitate more infrastructure (or at least more load testing)
* we'll need to identify any gaps in the prototype related to localization, metrics, geolocation, snippet administration, and figure out how to handle them

The snippets team would be glad to work on this with you. I will seek more clarity about when we can commit to it. Sound like a plan?
Depends on: 927426
Making this a tracker bug, since it will undoubtedly spin off several others.
Summary: Create JSON snippets endpoint for Firefox for Android → [tracker] Create JSON snippets endpoint for Firefox for Android
For me, the biggest driver would be when we're ready to deploy 'new sync' as a real, proper way of telling our existing install base about this updated service. That's not really going to be live until Q1 realistically (let's say early Q1 to be optimistic :) ).

Of course there is the missed opportunity for other messages, but linking it to 'new sync' readiness is the biggest driver in my opinion. (Partly because we know it was successful in driving attempts at setting up 'current/old' sync.)

Of course, *ideal* timing is early December so we can take advantage of holiday messaging in our primary markets.
OS: Mac OS X → All
Hardware: x86 → All
We've established a pretty good spec for this. I'm pasting it below.

=API response=
snippets: [
    {
        text: "Thanks for choosing Firefox! To get the most out of your browser, learn more about the latest features.",
        icon: "data:image/gif;base64,R0lGODlhEAAQAMQAA",
        url: "http://jskajfsalkjf.dfjkasdjiew.com/?id=23",
        target_geo: "US",
        id: 23
    },
    { ... }
]

=Expected Addon Behavior=
1. no more than once every 24 hrs, request snippets from snippets service (see URL structure below)
2. at least once every 30 days, request browser's country_code from geo.mozilla.org/country.json
3. filter snippets returned by snippets service by geo (excluding geo-targeted snippets with country_codes not matching browser's country_code)
4. 10% of the time a snippet is displayed, make an HTTP request to a URL on the metrics service that includes a snippet ID, the sample rate, perhaps other information (URL TBD)

=URL structure for requests to snippet service from Android addon=
https://snippets.mozilla.com/1/Fennec/28.0a1/20131030030201/Android_arm-eabi-gcc3/en-US/nightly/Linux%2018/default/default/

=Allowed Values of JSON response=
text: Plaintext only (not HTML), 140 character limit
icon: data uri for a static (not animated) gif/png
url: snippets service will append any parameters product team wants to have on the snippet URL sent to addon
target_geo: country_code, e.g. "US"
id: a snippet id
A simple, easy to read spec! Questions:

#2 Do we need to ping the web site? Can we just get the country code locally from Android?
#4 We should batch this data. We don't want to be making HTTP requests "out of batch" since that has a tendency to run down batteries.
(Reporter)

Comment 12

4 years ago
(In reply to Mark Finkle (:mfinkle) from comment #11)

> #2 Do we need to ping the web site? Can we just get the country code locally
> from Android?

Can Android give us the country that the phone is currently in? And can we get that from add-on code? If we're okay with sending a request once a day to get the snippets data, I feel like it's not a big deal to send a much smaller request once a month to get the country.

> #4 We should batch this data. We don't want to be making HTTP requests "out
> of batch" since that has a tendency to run down batteries.

This sounds like a smart idea, since we show this banner quite frequently with the new about:home design.

Also, for anyone who wants to follow along with the client-side development (mfinkle probably does), I'm working in a branch in my promo-banner add-on:
https://github.com/leibovic/promo-banner/blob/snippets/bootstrap.js
Depends on: 937373
Depends on: 937650
Depends on: 937653
(Reporter)

Updated

4 years ago
Depends on: 937820
Depends on: 938434
Depends on: 945880
JSON Snippets code is now on dev (snippets-dev.allizom.org). I created two test snippets that match "nightly" channel, all locales and US country. 

You can see the json  here

https://snippets-dev.allizom.org/json/1/Fennec/28.0a1/20131204030203/Android_arm-eabi-gcc3/en-US/nightly/Linux%2018/default/default/

Tested with Fennec Nightly and works!
Depends on: 964677
I believe this project can be considered finished, JSON snippets have been out in the wild for a while.
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
See Also: → bug 1155579
You need to log in before you can comment on or make changes to this bug.