Skip to content
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
1 change: 1 addition & 0 deletions examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ <h2 id="biq-ex-question">Loading question...</h2>
<div id="biq-ex-sheet" hidden></div>
</section>
</main>
<script src="https://cdn.jsdelivr.net/gh/kindel/app-kit@1e80086c9a4cfd40493e0ca44629fb9b96cf81f1/analytics.js" integrity="sha384-N4wQFJMyGG6iswmvSgIug97Il7wZuv3J7WTNctwa4jgxW+uJU7NMrNczXeTXMZCp" crossorigin="anonymous" defer></script>
<script src="js/biq-examples.js" defer></script>
</body>
</html>
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ <h1>Behavioral interview questions</h1>
<div id="bhiq-results" class="bhiq-results" aria-live="polite"></div>
</section>
</main>
<script src="https://cdn.jsdelivr.net/gh/kindel/app-kit@1e80086c9a4cfd40493e0ca44629fb9b96cf81f1/analytics.js" integrity="sha384-N4wQFJMyGG6iswmvSgIug97Il7wZuv3J7WTNctwa4jgxW+uJU7NMrNczXeTXMZCp" crossorigin="anonymous" defer></script>
<script src="js/biq.js" defer></script>
</body>
</html>
11 changes: 11 additions & 0 deletions js/biq-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
window.gtag("event", name, clean);
}

function kld(name, params) {
if (typeof window.kldTrack !== "function") return;
window.kldTrack(name, params);
}

var params = new URLSearchParams(window.location.search);
var principle = params.get("p") || "";
var question = params.get("q") || "";
Expand All @@ -30,6 +35,8 @@
var backEl = document.getElementById("biq-ex-back");
if (!questionEl || !statusEl || !sheetEl) return;

kld("app_view", { app: "biq" });

// Keep the company scope on the way back, so ?c=arm returns to Arm's bank.
if (backEl && company) {
try {
Expand Down Expand Up @@ -179,6 +186,7 @@
for (var i = 0; i < companies.length; i++) {
if (companies[i].id === target) c = companies[i];
}
if (c && c.id) kld("kld_company", { app: "biq", company: c.id, source: "url" });
var list = pickable(companies, c, bank && bank.facetQuestions);
if (!list.length) {
statusEl.textContent = "No examples for this set yet. Go back to the questions and pick another principle.";
Expand Down Expand Up @@ -659,6 +667,9 @@
.then(function (bank) {
attachFacetQuestions((bank && bank.companies) || [], bank && bank.facetQuestions);
var ctx = resolveContext(bank);
if (ctx.company && ctx.company.id) {
kld("kld_company", { app: "biq", company: ctx.company.id, source: "url" });
}
resolvedPrincipleId = ctx.principle && typeof ctx.principle.id === "number" ? ctx.principle.id : null;
renderHeader(ctx);
fetchPack();
Expand Down
19 changes: 19 additions & 0 deletions js/biq.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
window.gtag("event", name, clean);
}

function kld(name, params) {
if (typeof window.kldTrack !== "function") return;
window.kldTrack(name, params);
}

function examplesHref(principle, question, level, qid) {
// Resolve against the current document, not the origin root, so a relative
// examplesPage still works when the site is served from a subdirectory.
Expand All @@ -33,6 +38,8 @@
var results = document.getElementById("bhiq-results");
if (!input || !chips || !results) return;

kld("app_view", { app: "biq" });

var lpSelect = null;
var LEVELS = ["junior", "senior", "exec"];
var LEVEL_KEY = "bhiq-level";
Expand Down Expand Up @@ -295,8 +302,17 @@
var sel = document.getElementById("bhiq-company");
if (!sel) return;
sel.addEventListener("change", function () {
var prev = currentCompany ? currentCompany.id : "";
applyCompany(this.value, true);
track("biq_company", { biq_company: this.value, biq_page: "bank" });
if (currentCompany && currentCompany.id && currentCompany.id !== prev) {
kld("kld_company", {
app: "biq",
company: currentCompany.id,
previous_company: prev,
source: "picker"
});
}
});
}

Expand Down Expand Up @@ -571,6 +587,9 @@
companies = normalizeBank(bank);
attachFacetQuestions(companies, bank && bank.facetQuestions);
applyCompany(getCompanyId(), false);
if (currentCompany && currentCompany.id) {
kld("kld_company", { app: "biq", company: currentCompany.id, source: "url" });
}
bindCompany();
renderSelects(principles());
renderResults([], "");
Expand Down
Loading