Spreadfirefox affiliates: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Spreadfirefox|Go to the Spread Firefox wiki home]]
[[Spreadfirefox|Go to the Spread Firefox wiki home]]


= Background =
[https://wiki.mozilla.org/Affiliates Go to Spread Firefox Affiliates program wiki home]


The Spread Firefox Affiliates program contributes to many Firefox downloads by giving community members HTML buttons to place on their website.  Website visitors click these buttons, which leads to a destination site (e.g. the Firefox download page).
= The Affiliates program =


The sfx_affiliates module implements the various tools needed by the Affiliates program.
== What is it? ==


= Version 2 =
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.


With milestone 3.0, the sfx_affiliates module has been substantially rewritten.
Buttons come in many different shapes and forms...


==== Goals ====
http://sfx-images.mozilla.org/affiliates/thunderbird/reclaimyourinbox_small.png
The rewrite was done to accomplish a few things...


# Cleanliness of code, comments, and structure this makes it easier to make changes in the future,
http://sfx-images.mozilla.org/affiliates/Buttons/firefox2/firefox-spread-btn-3.png
# Correctness, i.e. points are counted correctly, aggregate stats are correct, etc
# Testability, this is an awkward system to test because it is spread out over many sites.
# Archiving.  Another big problem with v1 was that we were always deleting records, so if we had a problem longer than a month ago, the only way to get at those records would be to re-parse/tally the logs for that day/week/month


= Features =
http://www.spreadfirefox.com/files/images/affiliates_banners/banner-1.png


== Buttons ==
Our most popular buttons are the ones that lead to Firefox downloads...
== Stats & Points ==
 
== Content ==
http://sfx-images.mozilla.org/affiliates/Buttons/firefox3/FF3_88x31_g.png
== OG Project ==
 
http://sfx-images.mozilla.org/affiliates/Buttons/firefox3/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
** [http://svn.mozilla.org/projects/spreadfirefox.com/logs-parse/affiliates-download-counting/run.pl 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
** PHP code
** runs within Drupal framework
** [http://svn.mozilla.org/projects/spreadfirefox.com/trunk/sites/all/modules/sfx_affiliates/sfx_affiliates.module sfx_affiliates.module]
** most recently rewritten by Alex B
 
== 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

Latest revision as of 08:59, 8 September 2009

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