Sure, that works fine if you use google cloud functions + dgraph
but we people nowadays use Cloudflare Workers + dgraph
because google cloud functions and AWS lambda (efge) are very slow and much more expensive, than Cloudflare Workers 
anyway thanks a lot! I hope they will create a feature to opt out of that data