Skip to content

Commit

Permalink
feat: add trace point (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanzhidongyzby authored Jan 23, 2025
1 parent 963521c commit 9ccd267
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
5 changes: 5 additions & 0 deletions osgraph-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
// 解决 Multiple instances of Three.js being imported.的 warning, 参考:https://yanyunfeng.com/article/2
window.__THREE__ = null;
</script>
<script
src="https://ur.alipay.com/tracert_a4378.js"
crossorigin="anonymous"
async
></script>
</head>

<body>
Expand Down
1 change: 1 addition & 0 deletions osgraph-web/src/constants/log.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const SPAPOS = "a4378";
3 changes: 3 additions & 0 deletions osgraph-web/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface Window {
Tracert: any;
}
8 changes: 8 additions & 0 deletions osgraph-web/src/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,17 @@ import {
TUGRAPH_TECH,
X_LAB_GITHUB,
} from "../constants/links";
import { SPAPOS } from "../constants/log";
import { getIsMobile } from "../utils/isMobile";
import styles from "./index.module.less";

window?.Tracert?.call?.("set", {
spmAPos: SPAPOS,
spmBPos: location.pathname,
pathName: "首页"
});
window?.Tracert?.call?.("logPv");

const HomePage: React.FC = () => {
const [needFixed, setNeedFixed] = useState<boolean>(false);
const [templateType, setTemplateType] = useState<string>("REPO_CONTRIBUTE");
Expand Down
5 changes: 5 additions & 0 deletions osgraph-web/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import { RouterProvider } from "react-router-dom";
import "./i18n";
import router from "./router";

window?.Tracert?.call("set", {
spmAPos: "a4378",
bizType: "common"
});

ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<RouterProvider router={router} />
Expand Down
8 changes: 8 additions & 0 deletions osgraph-web/src/result/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
} from "../constants/index";
import { GRAPH_RENDER_MODEL } from "../constants/graph";
import { getUrlParams } from "../utils";
import { SPAPOS } from "../constants/log";
import { timestampToDate } from '../utils/date';
import LayoutSelect from "../components/layout-select";
import ExtendParams from "../components/extend-params";
Expand All @@ -37,6 +38,13 @@ export default () => {
const isMobile = getIsMobile();
const navigate = useNavigate();

window?.Tracert?.call?.("set", {
spmAPos: SPAPOS,
spmBPos: location.pathname,
pathName: "结果页"
});
window?.Tracert?.call?.("logPv");

const powerByRef = useRef<HTMLDivElement>(null);
const historyRef = useRef<{
redo?: () => void;
Expand Down

0 comments on commit 9ccd267

Please sign in to comment.