Experiment with moving Helpfulness Prompt to bottom of the page (#16448)
* Experiment with moving Helpfulness Prompt to bottom of the page * Update experiment.js * Update experiment.js
This commit is contained in:
@@ -69,10 +69,11 @@
|
|||||||
{{ renderedPage }}
|
{{ renderedPage }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
|
||||||
<div class="d-block d-xl-none border-top border-gray-light mt-4 markdown-body">
|
<div class="d-block d-xl-none border-top border-gray-light mt-4 markdown-body">
|
||||||
{% assign helpId = 'sm' %}
|
{% assign helpId = 'sm' %}
|
||||||
{% include helpfulness %}
|
{% include helpfulness %}
|
||||||
{% include contribution %}
|
{% include contribution %}
|
||||||
</div>
|
</div>
|
||||||
|
</article>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -40,27 +40,29 @@ export default function () {
|
|||||||
// const testName = '$test-name$'
|
// const testName = '$test-name$'
|
||||||
// const xbucket = bucket(testName)
|
// const xbucket = bucket(testName)
|
||||||
// if (xbucket === TREATMENT) { ... }
|
// if (xbucket === TREATMENT) { ... }
|
||||||
// x.addEventListener('click', evt => evt.preventDefault(); await sendSuccess(testName); evt())
|
// x.addEventListener('click', () => { sendSuccess(testName) })
|
||||||
|
|
||||||
const treatment = document.getElementById('quickstart-treatment')
|
const testName = 'helpfulness-prompt-to-bottom'
|
||||||
if (!treatment) return
|
|
||||||
|
|
||||||
const testName = 'quickstart-hello'
|
|
||||||
const xbucket = bucket(testName)
|
const xbucket = bucket(testName)
|
||||||
|
|
||||||
if (xbucket === TREATMENT) {
|
if (xbucket === TREATMENT) {
|
||||||
Array.from(
|
const bigHelpfulness = document.querySelector('#helpfulness-xl')
|
||||||
document.querySelectorAll('#article-contents > *')
|
const smallHelpfulness = document.querySelector('#helpfulness-sm')
|
||||||
).forEach(el => { el.hidden = true })
|
|
||||||
treatment.hidden = false
|
// Check that helpfulness prompt is present on this page
|
||||||
|
if (!(bigHelpfulness && smallHelpfulness)) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
document.documentElement.addEventListener('copy', () => {
|
// Remove the -xl prompts
|
||||||
sendSuccess(testName)
|
bigHelpfulness.parentElement.parentElement.removeChild(bigHelpfulness.parentElement)
|
||||||
})
|
|
||||||
|
|
||||||
// Hide sidebar navigation during test
|
// Always show the -sm prompt
|
||||||
Array.from(
|
smallHelpfulness.parentElement.classList.remove('d-xl-none')
|
||||||
document.querySelectorAll('.article-grid-toc-content > h3, .article-grid-toc-content ul')
|
}
|
||||||
).forEach(el => { el.hidden = true })
|
|
||||||
|
const votes = Array.from(document.querySelectorAll('.js-helpfulness [type=radio]'))
|
||||||
|
votes.forEach(voteEl => {
|
||||||
|
voteEl.addEventListener('change', () => { sendSuccess(testName) })
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user