Spreadfirefox affiliates

From MozillaWiki
Jump to: navigation, search

Go to the Spread Firefox wiki home

Go to Spread Firefox Affiliates program wiki home

The Affiliates program

What is it?

The Affiliates program is a Spread Firefox marketing project. Community members, or "affiliates", place "buttons" on websites all over the Internet; on blogs, forums, project websites, you name it.

Buttons come in many different shapes and forms...

reclaimyourinbox_small.png

firefox-spread-btn-3.png

banner-1.png

Our most popular buttons are the ones that lead to Firefox downloads...

FF3_88x31_g.png

200x32_best-yet.png

Part of the program involves tracking metrics related to the usage of these buttons. For example, how many Firefox downloads did Affiliate X create this week by having a button on their blog?

Types of metrics currently tracked:

  • Hits - Someone clicked a button
  • Downloads - A download button led to someone downloading Firefox.
  • Points - Download buttons have a point value associated with them. This allows users to collect points.
  • Last point change - The amount of points a user gained during the tally. There is no front-end UI for this. It helps to aggregate other stats/lists.

Lists:

  • Top 250 - Ordered by the number of downloads over the past 7 days
  • Top 5 - Same as Top 250
  • Top movers - The top 5 affiliates ordered by (total this week - total last week), where this week is the past 7 days, and last week was between 7-14 days ago.

Points can lead to rewards:

  • Featured Foxes
    • This program is currently offline.
    • Every quarter, 5 affiliates are chosen at random from the Top 250 list.
    • Selected affiliates are sent a t-shirt, and their name and point total are displayed on the Affiliates project homepage.
  • Upgrade the Web (upcoming project for 3.5 release)
    • A special set of download buttons.
    • Users who achieve at least 100 points over two weeks are entered into a raffle.

How does it work?

A button has a few key elements

  • Button image, <img src>
    • Images are hosted by IT on the static cluster
  • Destination, <a href>
    • Where does the button link to when someone clicks it?
    • This URL has some key elements also. This is how the metrics begin.
      • Affiliates user ID and button ID are appended to the destination as query params
      • ex: mozilla.com/firefox/?from=sfx&uid=555&t=209
      •  ?from=sfx - self-explanatory
      • &uid=555 - this is the account ID of the spreadfirefox.com user that owns this button
      • &t=209 - this identifies which button this is


A script parses the access logs of destination websites, looking for affiliates referrals, using the key elements described above

  • mozilla.com
    • We look here for visitors coming '?from=sfx'
    • Each visitor's affiliate ID, button ID, IP address, and timestamp are extracted
  • download.mozilla.org
    • We look here for downloads that relate to affiliate traffic, using the IP addresses we extracted from mozilla.com logs.
    • If a download occurs from one of these extracted IP addresses, the referrals from this IP address are marked as having a download.
    • Only one download per IP, per day, can be counted.


All these affiliates referrals are inserted into the SFx database for tallying

  • A script goes over the referrals and tallies hits, downloads, and points for each affiliates.
    • If a user doesn't have an existing affiliate record, one is created.
  • Next, lists like Top 250 and Top Movers are gathered.

Implementation details

  • log parse script
    • Perl script
    • runs on dm-stats01
    • run.pl
    • written by Alex B
    • outputs SQL INSERT queries for each affiliate referral record
    • a cron job picks up this output file and runs the queries on the SFx DB
  • Tally scripts

Ideas

  • Have all buttons go through a lightweight jump host, and be redirected to their destination. This would make the log parsing easier and more efficient.
  • Track metrics on sfx-images.mozilla.com, this would tell use how many views buttons get