Skip to content

Commit

Permalink
fix custom events reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
baev committed Jun 19, 2023
1 parent da87a8e commit a530173
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 10 deletions.
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
2 changes: 1 addition & 1 deletion allure-generator/src/main/resources/tpl/index.html.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-FVWC4GKEYS');
gtag('config', 'G-FVWC4GKEYS', { 'debug_mode':true });
gtag('allureVersion', '${allureVersion}')
gtag('reportUuid', '${reportUuid}')
</script>
Expand Down

0 comments on commit a530173

Please sign in to comment.