Skip to content

Commit

Permalink
Set the event value of "yes" to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Nov 13, 2023
1 parent 8f4c47f commit c4348b9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ For the full list of changes, see the [release][0.8.0] notes.

**Breaking changes**:

- **Page feedback**, or [User feedback] ([#1726]):
- Feedback-event attribute changes:
- Event `name` is `page_helpful`rather than`click`
- Event `value` for "yes" is 100 by default, rather than 1, allowing for
more response options in the future. To override the default set
`params.ui.feedback.max_value`.
- SCSS: `@function prepend()` and file `assets/scss/support/_functions.scss`
have been dropped. Instead use the more general SASS/SCSS list `join()`
function ([#1385]).
Expand All @@ -33,7 +39,10 @@ For the full list of changes, see the [release][0.8.0] notes.
**Other changes**:

[#1385]: https://github.com/google/docsy/issues/1385
[#1726]: https://github.com/google/docsy/pull/1726
[0.8.0]: https://github.com/google/docsy/releases/v0.8.0/#FIXME
[User feedback]:
https://www.docsy.dev/docs/adding-content/feedback/#user-feedback

## 0.7.2

Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/feedback.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ <h2 class="feedback--title">{{- i18n "feedback_title" -}}</h2>
yesButton.addEventListener('click', () => {
yesResponse.classList.add('feedback--response__visible');
disableButtons();
sendFeedback(1);
{{ $maxValue := .max_value | default 100 -}}
sendFeedback({{ $maxValue }});
});
noButton.addEventListener('click', () => {
noResponse.classList.add('feedback--response__visible');
Expand Down
6 changes: 5 additions & 1 deletion userguide/content/en/docs/adding-content/feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ of every documentation page, as shown in Figure 1.
</figure>

After clicking **Yes** the user should see a response like Figure 2. You can
[configure] the response text in the project's [configuration file] `hugo.toml`.
[configure] the response text in your project's [configuration file].

<figure>
<img src="/images/yes.png"
Expand Down Expand Up @@ -176,6 +176,10 @@ params:

4. Save and close `hugo.toml`/`hugo.yaml`/`hugo.json`.

By default, Docsy emits an event value of 100 when a user clicks "yes". You can
change this value by setting `params.ui.feedback.max_value` to a positive
integer. Docsy uses 0 for "no" events.

### Access the feedback data

This section assumes basic familiarity with Google Analytics. For example, you
Expand Down

0 comments on commit c4348b9

Please sign in to comment.