Created
October 26, 2010 17:54
-
-
Save bowd/647418 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if exists?(referrer = event[:referrer]) | |
if ((matches = referrer.match(/([^\#]+)\#(.+)?\:(.+)?/))) && matches.size == 4 | |
detail = "#{DETAILS}.#{escape(matches[2])}.#{escape(matches[3])}.#{PLAYS}" | |
# Here we split the stuff in the specialised referrer | |
# i.e. facebook.com#p:AwsomePage | |
# And we increment the detail below, but in the REFERRER for the update | |
# referrer is passed instead of matches[1] ( which is just the facebook.com ) | |
buckets.each do |bucket| | |
@referrers_per_track.update({ TRACK => track_id, BUCKET => bucket, REFERRER => referrer }, { | |
'$inc' => { | |
PLAYS => 1, | |
detail => 1 | |
}}, :upsert => true) | |
@referrers_per_user.update({ USER => owner_id, BUCKET => bucket, REFERRER => ref referrer }, { | |
'$inc' => { | |
PLAYS => 1, | |
detail => 1 | |
}}, :upsert => true) | |
end | |
else |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment