mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-29 18:50:00 +08:00
📝 add search icon to ga event
This commit is contained in:
parent
ea13c19da7
commit
7458a9abcd
@ -101,6 +101,7 @@
|
||||
"@packtracker/webpack-plugin": "^2.0.1",
|
||||
"@sentry/browser": "^5.4.0",
|
||||
"@types/classnames": "^2.2.8",
|
||||
"@types/gtag.js": "^0.0.3",
|
||||
"@types/prop-types": "^15.7.1",
|
||||
"@types/react": "^16.9.0",
|
||||
"@types/react-dom": "^16.8.4",
|
||||
|
@ -100,6 +100,12 @@ class PicSearcher extends Component<PicSearcherProps, PicSearcherState> {
|
||||
},
|
||||
);
|
||||
let icons = await res.json();
|
||||
if (gtag && icons.length >= 1) {
|
||||
gtag('event', 'icon', {
|
||||
event_category: 'search-by-image',
|
||||
event_label: icons[0].class_name,
|
||||
});
|
||||
}
|
||||
icons = icons.map((i: any) => ({ score: i.score, type: i.class_name.replace(/\s/g, '-') }));
|
||||
this.setState(() => ({ icons, loading: false, error: false }));
|
||||
} catch (err) {
|
||||
|
Loading…
Reference in New Issue
Block a user