Last active
August 29, 2015 14:13
-
-
Save adamrneary/0766ff306a4a4daa6aa6 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
| // This function mimics how our upstream code (in this case, the Flask beacon) | |
| // pipes video events to Kinesis. | |
| // | |
| // campaignId - An Integer id for the campaign being viewed | |
| // eventName - A String for the name of the event being recorded | |
| // | |
| // Returns a String containing the data as passed to Kinesis | |
| function generateEvent(campaignId, eventName) { | |
| var analyticsId = '123-' + campaignId + '-456'; | |
| var properties = { | |
| ip: '79.104.4.85', | |
| mp_lib: 'as3', | |
| clip: 'konets-f8gr', | |
| referrer: 'https://play.adventr.tv/video-9-76005686', | |
| viewId: 'CENYr73adwDEd55MyrmTrmjK2QEDpUAe', | |
| http_referrer: 'https://play.adventr.tv/embed.html?source=ochre-play&load=0&poster=//d252srr1zuysk4.cloudfront.net/clients/43126710716529437798-2004/4575/thumbnails/1-i5nd_poster_0000.png&width=352&height=288&x=http://static.theochre.com/clients/43126710716529437798-2004/4575/published/43126710716529437798-2004-video-9-76005686.data', | |
| analyticsId: analyticsId, | |
| flashVersion: 'MAC 16,0,0,235', | |
| token: 'ochre-vpaid', | |
| distinct_id: '6886A9F3-680C-FD5C-41BC-CB4F4E17F6F0', | |
| Video: 'Video 9', | |
| time: '1419097235', | |
| swfUrl: 'https://d252srr1zuysk4.cloudfront.net/advntr/AdvntrPlayer.swf', | |
| duration: 405, | |
| pageUrl: 'https://d252srr1zuysk4.cloudfront.net/advntr/AdvntrPlayer.swf', | |
| ua: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/7.0.6 Safari/537.78.2' | |
| }; | |
| var rawPayload = { | |
| event_id: '2014-12-20:35', | |
| event_date: '2014-12-20', | |
| event: eventName, | |
| event_time: '1419097235_YX4', | |
| properties: JSON.stringify(properties) | |
| }; | |
| return JSON.stringify(rawPayload); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment