← Back
Connect Your Google Cloud Website to Agent & LLM Analytics
Overview
This integration uses Google Cloud Pub/Sub and Cloud Logging to send analytics events to Dark Visitors from your Google Cloud CDN. Please contact us if you need help getting set up.
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.,
dark-visitors-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.,
dark-visitors-subscription) - Select the topic you created in Step 1
- For Delivery type, select Push
- For Endpoint URL, enter:
https://api.darkvisitors.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 Dark Visitors 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.,
dark-visitors-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 the Dark Visitor agent in the realtime timeline within a few minutes.