From 59d45e7eb6571085d175b28691307cc04143a91c Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Fri, 19 Jul 2024 15:43:26 -0700 Subject: [PATCH] Add segment script and update iframe attributes for YouTube video player --- docs/introduction.md | 2 +- docusaurus.config.ts | 4 +++ static/js/segment.js | 83 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 static/js/segment.js diff --git a/docs/introduction.md b/docs/introduction.md index faddaae5..e65b1f9f 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -23,7 +23,7 @@ performing continuous, incremental reviews for each commit within a pull request. Review feedback is sent back to the pull requests and can be directly committed. - + **CodeRabbit** integrates into code repositories using GitHub or GitLab webhooks and monitors events related to Pull Request (PR) and Merge Request (MR) changes. diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 5b000235..83344150 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -118,6 +118,10 @@ const config: Config = { "https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js", "/docs/js/code-block-buttons.js", "https://cdnjs.cloudflare.com/ajax/libs/axios/1.2.1/axios.min.js", + { + src: "/js/segment.js", + async: false, + }, { src: "https://js.hs-scripts.com/43613284.js", type: "text/javascript", diff --git a/static/js/segment.js b/static/js/segment.js new file mode 100644 index 00000000..b8eb912b --- /dev/null +++ b/static/js/segment.js @@ -0,0 +1,83 @@ +!(function () { + var i = "analytics", + analytics = (window[i] = window[i] || []); + if (!analytics.initialize) + if (analytics.invoked) + window.console && + console.error && + console.error("Segment snippet included twice."); + else { + analytics.invoked = !0; + analytics.methods = [ + "trackSubmit", + "trackClick", + "trackLink", + "trackForm", + "pageview", + "identify", + "reset", + "group", + "track", + "ready", + "alias", + "debug", + "page", + "screen", + "once", + "off", + "on", + "addSourceMiddleware", + "addIntegrationMiddleware", + "setAnonymousId", + "addDestinationMiddleware", + "register", + ]; + analytics.factory = function (e) { + return function () { + if (window[i].initialized) + return window[i][e].apply(window[i], arguments); + var n = Array.prototype.slice.call(arguments); + if ( + ["track", "screen", "alias", "group", "page", "identify"].indexOf( + e + ) > -1 + ) { + var c = document.querySelector("link[rel='canonical']"); + n.push({ + __t: "bpc", + c: (c && c.getAttribute("href")) || void 0, + p: location.pathname, + u: location.href, + s: location.search, + t: document.title, + r: document.referrer, + }); + } + n.unshift(e); + analytics.push(n); + return analytics; + }; + }; + for (var n = 0; n < analytics.methods.length; n++) { + var key = analytics.methods[n]; + analytics[key] = analytics.factory(key); + } + analytics.load = function (key, n) { + var t = document.createElement("script"); + t.type = "text/javascript"; + t.async = !0; + t.setAttribute("data-global-segment-analytics-key", i); + t.src = + "https://cdn.segment.com/analytics.js/v1/" + + key + + "/analytics.min.js"; + var r = document.getElementsByTagName("script")[0]; + r.parentNode.insertBefore(t, r); + analytics._loadOptions = n; + }; + analytics._writeKey = "IvcQvqtKQS24hYl0lkuvsfFSCpCse4F8"; + analytics.SNIPPET_VERSION = "5.2.0"; + analytics.load("IvcQvqtKQS24hYl0lkuvsfFSCpCse4F8"); + analytics.page(); + } +})();