Skip to content

Commit 657bd74

Browse files
committed
google analytics
1 parent f8ed284 commit 657bd74

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

backend/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from flask import Flask, request, jsonify, send_file, session, current_app
2-
from handright import Template, handwrite
2+
from handrightbeta import Template, handwrite
33
from PIL import Image, ImageFont
44
from threading import Thread
55
from PIL import Image, ImageFont, ImageQt, ImageDraw
@@ -302,6 +302,7 @@ def generate_handwriting():
302302
perturb_x_sigma=int(data["perturb_x_sigma"]), # 笔画横向偏移随机扰动
303303
perturb_y_sigma=int(data["perturb_y_sigma"]), # 笔画纵向偏移随机扰动
304304
perturb_theta_sigma=float(data["perturb_theta_sigma"]), # 笔画旋转偏移随机扰动
305+
305306
)
306307
images = handwrite(text_to_generate, template)
307308
logger.info("images generated successfully")

frontend/src/assets/logo.png

-6.69 KB
Binary file not shown.

frontend/src/main.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@ import * as Sentry from "@sentry/vue";
1616
const app = createApp(App);
1717

1818

19+
// 异步加载Google Analytics的JavaScript库
20+
const script = document.createElement('script')
21+
script.async = true
22+
script.src = 'https://www.googletagmanager.com/gtag/js?id=G-GB1XG89B6Z'
23+
document.head.appendChild(script)
24+
25+
// 当脚本加载完成后进行初始化
26+
script.onload = () => {
27+
// 初始化window.dataLayer数组
28+
window.dataLayer = window.dataLayer || []
29+
30+
// 定义gtag函数
31+
function gtag() {
32+
window.dataLayer.push(arguments)
33+
}
34+
35+
// 调用gtag函数进行配置
36+
gtag('js', new Date())
37+
gtag('config', 'G-GB1XG89B6Z')
38+
}
1939

2040
Sentry.init({
2141
app,

0 commit comments

Comments
 (0)