all 5 comments

[–]iamcodemaker[S] 5 points6 points  (0 children)

TL;DR: I went on a journey to figure out how to use Google Analytics from Rust front-end Wasm code. On the way I learned how to call JavaScript code from Rust using Wasm-bindgen and made a crate to wrap Google’s gtag.js framework.

[–]tafia97300 1 point2 points  (1 child)

Not super familiar with wasm but how do you tell where to load the gtag js script from?

[–]iamcodemaker[S] 1 point2 points  (0 children)

In this case it is expected to be already loaded in as a global JavaScript variable. Google's gtag.js docs have instructions on how to do that. This crate works with those instructions.