Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix custom events reporting #2031

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.qameta.allure.context.JacksonContext;
import io.qameta.allure.context.MarkdownContext;
import io.qameta.allure.context.RandomUidContext;
import io.qameta.allure.context.ReportInfoContext;
import io.qameta.allure.core.AttachmentsPlugin;
import io.qameta.allure.core.Configuration;
import io.qameta.allure.core.LaunchResults;
Expand Down Expand Up @@ -81,6 +82,7 @@ public final class DummyReportGenerator {
private static final List<Extension> EXTENSIONS = Arrays.asList(
new JacksonContext(),
new MarkdownContext(),
new ReportInfoContext("dev"),
new FreemarkerContext(),
new RandomUidContext(),
new MarkdownDescriptionsPlugin(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export default class GaBehavior extends Behavior {
return { [gaKey]: value };
})
.reduce((a, b) => Object.assign(a, b), {});
gtag({ ...eventParams, event });
gtag(event, eventParams);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class LanguageSelectView extends PopoverView {
const langId = this.$(e.currentTarget).data("id");
settings.setLanguage(langId);
i18next.changeLanguage(langId);
gtag({ event: "language_change", language: langId });
gtag( "language_change", { language: langId });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MarksToggleView extends View {
const checked = el.hasClass("n-label-mark");
const marks = this.settings.getVisibleMarks();
this.settings.setVisibleMarks(Object.assign({}, marks, { [name]: checked }));
gtag({ event: "marks_toggle_click", status: name, checked });
gtag("marks_toggle_click", { status: name, checked });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class NodeSearchView extends View {
@on("input input")
onChangeSorting(e) {
this.state.set(SEARCH_QUERY_KEY, e.target.value);
gtag({ event: "search" });
gtag("search");
}

close() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class SideBySideView extends View {
onDragEnd: function() {
const sizes = splitter.getSizes();
settings.setSideBySidePosition(sizes);
gtag({ event: "side-by-side-resize", sizes });
gtag("side-by-side-resize", { sizes });
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class StatusToggleView extends View {
const checked = el.hasClass("n-label");
const statuses = this.settings.getVisibleStatuses();
this.settings.setVisibleStatuses(Object.assign({}, statuses, { [name]: checked }));
gtag({ event: "status_toggle_click", status: name, checked });
gtag("status_toggle_click", { status: name, checked });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class TreeViewContainer extends View {
onInfoClick() {
const show = this.settings.isShowGroupInfo();
this.settings.setShowGroupInfo(!show);
gtag({ event: "tree_info_click", enable: !show });
gtag("tree_info_click", { enable: !show });
}

onRender() {
Expand Down
6 changes: 5 additions & 1 deletion allure-generator/src/main/javascript/utils/gtag.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export default function gtag() {
export default function gtag(event, params) {
add("event", event, params);
}

function add() {
window.dataLayer = Array.isArray(window.dataLayer) ? window.dataLayer : [];
window.dataLayer.push(arguments);
}
2 changes: 1 addition & 1 deletion allure-generator/src/main/javascript/utils/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function initTranslations() {
},
(err) => (err ? reject(err) : resolve()),
);
gtag({ event: "init_language", language: language || "en" });
gtag("init_language", { language: language || "en" });
});
}

Expand Down