FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
github-docs/javascripts/experiment.js at main · 0xdevalias/github-docs · GitHub
0xdevalias
/
github-docs
Public
forked from
github/docs
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
github-docs
/
javascripts
/
experiment.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (24 loc) · 747 Bytes
Breadcrumbs
github-docs
/
javascripts
/
experiment.js
Copy path
File metadata and controls
28 lines (24 loc) · 747 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import
murmur
from
'imurmurhash'
import
{
getUserEventsId
,
sendEvent
}
from
'./events'
// import h from './hyperscript'
const
TREATMENT
=
'TREATMENT'
const
CONTROL
=
'CONTROL'
export
function
bucket
(
test
)
{
const
id
=
getUserEventsId
(
)
const
hash
=
murmur
(
test
)
.
hash
(
id
)
.
result
(
)
return
hash
%
2
?
TREATMENT
:
CONTROL
}
export
async
function
sendSuccess
(
test
)
{
return
sendEvent
(
{
type
:
'experiment'
,
experiment_name
:
test
,
experiment_variation
:
bucket
(
test
)
.
toLowerCase
(
)
,
experiment_success
:
true
}
)
}
export
default
function
(
)
{
// const testName = '$test-name$'
// const xbucket = bucket(testName)
// if (xbucket === TREATMENT) { ... }
// x.addEventListener('click', () => { sendSuccess(testName) })
}
Back
|
FazBrowse Home
|
New Git URL