payload: {"action":"closed","issue":{"url":"https://api.github.com/repos/chrisblakley/Nebula/issues/1920","repository_url":"https://api.github.com/repos/chrisblakley/Nebula","labels_url":"https://api.github.com/repos/chrisblakley/Nebula/issues/1920/labels{/name}","comments_url":"https://api.github.com/repos/chrisblakley/Nebula/issues/1920/comments","events_url":"https://api.github.com/repos/chrisblakley/Nebula/issues/1920/events","html_url":"https://github.com/chrisblakley/Nebula/issues/1920","id":448492942,"node_id":"MDU6SXNzdWU0NDg0OTI5NDI=","number":1920,"title":"Detect rage clicks as GA event","user":{"login":"chrisblakley","id":6349678,"node_id":"MDQ6VXNlcjYzNDk2Nzg=","avatar_url":"https://avatars3.githubusercontent.com/u/6349678?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisblakley","html_url":"https://github.com/chrisblakley","followers_url":"https://api.github.com/users/chrisblakley/followers","following_url":"https://api.github.com/users/chrisblakley/following{/other_user}","gists_url":"https://api.github.com/users/chrisblakley/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisblakley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisblakley/subscriptions","organizations_url":"https://api.github.com/users/chrisblakley/orgs","repos_url":"https://api.github.com/users/chrisblakley/repos","events_url":"https://api.github.com/users/chrisblakley/events{/privacy}","received_events_url":"https://api.github.com/users/chrisblakley/received_events","type":"User","site_admin":false},"labels":[{"id":90283767,"node_id":"MDU6TGFiZWw5MDI4Mzc2Nw==","url":"https://api.github.com/repos/chrisblakley/Nebula/labels/:thought_balloon:%20Question%20/%20Research","name":":thought_balloon: Question / Research","color":"cc317c","default":false},{"id":114828005,"node_id":"MDU6TGFiZWwxMTQ4MjgwMDU=","url":"https://api.github.com/repos/chrisblakley/Nebula/labels/Frontend%20(Script)","name":"Frontend (Script)","color":"e5bb31","default":false},{"id":108846447,"node_id":"MDU6TGFiZWwxMDg4NDY0NDc=","url":"https://api.github.com/repos/chrisblakley/Nebula/labels/%F0%9F%92%A1%20Feature%20Request","name":"💡 Feature Request","color":"b7f79b","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/chrisblakley/Nebula/milestones/8","html_url":"https://github.com/chrisblakley/Nebula/milestone/8","labels_url":"https://api.github.com/repos/chrisblakley/Nebula/milestones/8/labels","id":3940423,"node_id":"MDk6TWlsZXN0b25lMzk0MDQyMw==","number":8,"title":"8.0 Eight-Burst","description":"","creator":{"login":"chrisblakley","id":6349678,"node_id":"MDQ6VXNlcjYzNDk2Nzg=","avatar_url":"https://avatars3.githubusercontent.com/u/6349678?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisblakley","html_url":"https://github.com/chrisblakley","followers_url":"https://api.github.com/users/chrisblakley/followers","following_url":"https://api.github.com/users/chrisblakley/following{/other_user}","gists_url":"https://api.github.com/users/chrisblakley/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisblakley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisblakley/subscriptions","organizations_url":"https://api.github.com/users/chrisblakley/orgs","repos_url":"https://api.github.com/users/chrisblakley/repos","events_url":"https://api.github.com/users/chrisblakley/events{/privacy}","received_events_url":"https://api.github.com/users/chrisblakley/received_events","type":"User","site_admin":false},"open_issues":80,"closed_issues":22,"state":"open","created_at":"2019-01-03T22:22:00Z","updated_at":"2019-05-27T03:26:38Z","due_on":"2020-05-01T07:00:00Z","closed_at":null},"comments":2,"created_at":"2019-05-25T19:00:22Z","updated_at":"2019-05-27T03:26:37Z","closed_at":"2019-05-27T03:26:37Z","author_association":"OWNER","body":"This is something I'm testing and will decide whether to keep it after a trial period if it is useful. This detects 5 clicks within 100px in 3 seconds and logs the event along with a description of what was element was clicked.\r\n\r\nExample event label:\r\n```\r\n5 clicks in 0.692 seconds detected within 0px of li.delimiter (inside section#content-section)\r\n```\r\n\r\nHere's what I'm doing (for future reference in case I decide not to keep it):\r\n```js\r\n//Detect \"Rage Clicks\"\r\nvar clickEvents = [];\r\nnebula.dom.document.on('click', 'body', function(e){\r\n\tclickEvents.push({\r\n\t\tevent: e,\r\n\t\ttime: new Date()\r\n\t});\r\n\r\n\t//remain only required number of click events and remove left of them.\r\n\tif ( clickEvents.length > 5 ){\r\n\t\tclickEvents.splice(0, clickEvents.length - 5);\r\n\t}\r\n\r\n\t//detect 3 click in 5 sec\r\n\tif ( clickEvents.length >= 5 ){\r\n\t\tvar numberOfClicks = 5; //Number of clicks to detect within the period\r\n\t\tvar period = 3; //The period to listen for the number of clicks\r\n\r\n\t\tvar last = clickEvents.length - 1;\r\n\t\tvar timeDiff = (clickEvents[last].time.getTime() - clickEvents[last - numberOfClicks + 1].time.getTime()) / 1000;\r\n\r\n\t\t//Ignore event periods longer than desired\r\n\t\tif ( timeDiff > period ){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t//Loop through the last number of click events to check the distance between them\r\n\t\tvar max_distance = 0;\r\n\t\tfor ( i = last - numberOfClicks+1; i < last; i++ ){\r\n\t\t\tfor ( j = i+1; j <= last; j++ ){\r\n\t\t\t\tvar distance = Math.round(Math.sqrt(Math.pow(clickEvents[i].event.clientX - clickEvents[j].event.clientX, 2) + Math.pow(clickEvents[i].event.clientY - clickEvents[j].event.clientY, 2)));\r\n\t\t\t\tif ( distance > max_distance ){\r\n\t\t\t\t\tmax_distance = distance;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//Ignore if distance is outside 100px radius\r\n\t\t\t\tif ( distance > 100 ){\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar thisEvent = {\r\n\t\t\tevent: e,\r\n\t\t\tcategory: 'Rage Clicks',\r\n\t\t\taction: 'Detected',\r\n\t\t\tclicks: numberOfClicks,\r\n\t\t\tperiod: timeDiff,\r\n\t\t\tselector: domObjectToSelector(e.target),\r\n\t\t\tclosestID: domObjectToSelector(jQuery(e.target).closest('[id]')),\r\n\t\t}\r\n\r\n\t\tthisEvent.description = numberOfClicks + ' clicks in ' + timeDiff + ' seconds detected within ' + max_distance + 'px of ' + thisEvent.selector + ' (inside ' + thisEvent.closestID + ')';\r\n\r\n\t\tnebula.dom.document.trigger('nebula_event', thisEvent);\r\n\t\tga('send', 'event', thisEvent.category, thisEvent.action, thisEvent.description);\r\n\r\n\t\tclickEvents.splice(clickEvents.length-5, 5); //Remove unused click points\r\n\t}\r\n});\r\n```"}}
other: {"actor":{"display_login":"chrisblakley"}}