Commit 51c2a8a
committed
Improve social link platform detection
Replace brittle href.includes checks with a URL-based detector. Adds hostMatches and detectPlatformFromHref helpers to parse link hostnames (lowercased), handle subdomains, and detect GitHub, Instagram and Discord (discord.gg/discord.com). Uses try/catch and returns 'Unknown' fallback, then uses the detected platform when sending the GA event.1 parent ba48756 commit 51c2a8a
1 file changed
Lines changed: 29 additions & 11 deletions
Lines changed: 29 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1188 | 1188 | | |
1189 | 1189 | | |
1190 | 1190 | | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
1191 | 1218 | | |
1192 | 1219 | | |
1193 | 1220 | | |
1194 | | - | |
| 1221 | + | |
1195 | 1222 | | |
1196 | | - | |
1197 | | - | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
| 1223 | + | |
1206 | 1224 | | |
1207 | 1225 | | |
1208 | 1226 | | |
| |||
0 commit comments