Table
1. How it work?
Gather town will request your video link and get a preview picture when the user passes the video object. If we collect this request log data, then we can count the user traffic numbers.

So let’s build up a middleware server between the Gather town and video storage, then we can get user IP & user agent from the server.

2. Update your video to Google Storage
- Upload your video to Google Storage
- Grand the access to public

- Then, copy your public link.

3. Build up your event log server with Cloud function
- Build up your Google Cloud Function
- Copy below script to your Edit function
1 2 3 4 5 6 7 8 9 |
from flask import redirect def main_pycon(request): print(f"IP: {request.remote_addr}") print(f"User-Agent: {request.headers.get('User-Agent')}") ''' can add your code here, send the ip & user_agent to your database ''' return redirect("https://storage.cloud.google.com/demo-flask-vieod/pycon.mp4") |

- After deployment, you can copy the link from the trigger tab. (see below picture)

4. Create Video in Gather Town
- Open your Gather town
- Put your Cloud Function link to the Video(Url) place.
- Set the Activation distance

- Then, you can get the IP & user-agent in your database or cloud function log.

Thanks for your reading. I hope this article will help you better track user traffic.
References: