mirror of
https://github.com/Maks1mS/free-ozon-dpr.git
synced 2025-10-21 01:17:31 +03:00
more analytics
This commit is contained in:
32
src/analytics.js
Normal file
32
src/analytics.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import { el } from "./utils.js";
|
||||
|
||||
class Analytics {
|
||||
static event(name, data = undefined) {
|
||||
if (typeof ym !== 'undefined') {
|
||||
// eslint-disable-next-line no-undef
|
||||
ym(window.YANDEX_METRICA_ID, 'reachGoal', name, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const popupPVZId = el("popup-pvz-id");
|
||||
const pvzData = { pvz: popupPVZId.innerText };
|
||||
|
||||
const popupLink = el("popup-link");
|
||||
const sourceLink = el("popup-source");
|
||||
const infoPopupButton = el("info-popup-button");
|
||||
|
||||
popupLink.addEventListener("click", function () {
|
||||
Analytics.event("pvz-link-clicked", pvzData);
|
||||
});
|
||||
|
||||
sourceLink.addEventListener("click", function () {
|
||||
Analytics.event("pvz-link-clicked", pvzData);
|
||||
});
|
||||
|
||||
infoPopupButton.addEventListener("click", function () {
|
||||
Analytics.event("info-popup-closed");
|
||||
});
|
||||
});
|
||||
|
@@ -93,7 +93,7 @@
|
||||
<input type="checkbox" name="no-show">
|
||||
Больше не показывать
|
||||
</label>
|
||||
<button>Я прочитал и понял прочитанное</button>
|
||||
<button id="info-popup-button">Я прочитал и понял прочитанное</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -4,6 +4,7 @@ import map from "./map";
|
||||
|
||||
import "./info-popup";
|
||||
import "./popup";
|
||||
import "./analytics";
|
||||
|
||||
import mergedData from "../merged-data.json";
|
||||
import { createFeatures } from "./features";
|
||||
|
Reference in New Issue
Block a user