← Back
Send Visit Events From Your Google Cloud Website
Step 1: Create a Pub/Sub Topic
- Sign in to the Google Cloud Console
- Navigate to Pub/Sub by searching for "topics" in the search bar
- Click Create topic
- Enter a Topic ID (e.g.
known-agents-topic) - Uncheck Add a default subscription (we'll create a custom one in the next step)
- Click Create
Step 2: Create a Subscription
- Navigate to the Subscriptions tab in the left sidebar
- Click Create subscription
- Enter a Subscription ID (e.g.
known-agents-subscription) - Select the topic you created in Step 1
- For Delivery type, select Push
- For Endpoint URL, enter:
https://api.knownagents.com/logs/google-cloud
- Check Enable authentication
- For Service account, select an existing service account or create a new one
- Copy the service account email (e.g.
my-service-account@my-project.iam.gserviceaccount.com) - If needed, click Grant to grant the required permissions
- Click Create to create the subscription
Step 3: Register Your Service Account
- Navigate to your Known Agents Account page
- In the Service Account Email field in the Google Cloud section, paste the service account email you copied in Step 2
- Click Save
Step 4: Create a Log Sink
- Navigate to Log Router by searching for "log router" in the search bar
- Click Create sink
- Enter a Sink name (e.g.
known-agents-log-sink) - In the Sink destination section:
- Select Cloud Pub/Sub topic as the sink service
- In the Sink destination field, select the topic you created in Step 1
Step 5: Configure Log Filters
- In the Choose logs to include in sink section, add the following filters:
resource.type="http_load_balancer"
resource.labels.forwarding_rule_name="YOUR_FORWARDING_RULE_NAME"
resource.labels.url_map_name="YOUR_URL_MAP_NAME"
- To find your forwarding rule and URL map names:
- In the Google Cloud Console, navigate to Network Services by searching for "network services" in the search bar
- Click on your load balancer
- The forwarding rule name is listed in the Frontend section
- The URL map name is listed in the Host and path rules section
- Replace the placeholder values in the filter with the names you found
- If you have multiple load balancers, you can modify the filter to include logs from multiple load balancers by using the OR operator:
resource.type="http_load_balancer"
(resource.labels.forwarding_rule_name="YOUR_FIRST_FORWARDING_RULE_NAME"
AND resource.labels.url_map_name="YOUR_FIRST_URL_MAP_NAME")
OR
(resource.labels.forwarding_rule_name="YOUR_SECOND_FORWARDING_RULE_NAME"
AND resource.labels.url_map_name="YOUR_SECOND_URL_MAP_NAME")
- Click Create Sink
Step 6: Test Your Integration
- Navigate to the Projects page
- Select your project
- Click Settings
- Click Send a Test Visit
- Click Realtime
If your website is correctly connected, you should see visits from a test agent in the realtime timeline within a few seconds.
MCP Calls and Agentic Commerce Interactions
This integration only sends pageview events. If you also want to send MCP calls and agentic commerce interactions, send those events through the REST API. For example, you can use the Cloudflare Worker alongside this integration. Otherwise, use the Cloudflare Worker guide as an example of how to send only MCP calls and agentic commerce interactions without duplicating pageview events.