Connect GA4 by service account
POST
https://seolyticize.com /api/v1/tools/connect_google_analytics_service_account Connects a client's GA4 property as the agency's Google service account, once the property's owner has added that address with the Viewer role. Answers 'they added our address in GA4, connect it'. propertyId is GA4's numeric property id (Admin → Property details), not a G- measurement id. Access is checked with Google first, and refused with the exact steps when it is not granted yet. Free.
Request body application/json
clientIdstringrequiredpropertyIdstringrequired{
"clientId": "string",
"propertyId": "string"
}Code samples
cURL
curl -X POST "https://seolyticize.com/api/v1/tools/connect_google_analytics_service_account" \
-H "Content-Type: application/json" \
-d '{"clientId":"string","propertyId":"string"}'TypeScript
const res = await fetch('https://seolyticize.com/api/v1/tools/connect_google_analytics_service_account', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({"clientId":"string","propertyId":"string"}),
});
const data = await res.json();Python
import requests
res = requests.request(
"POST",
"https://seolyticize.com/api/v1/tools/connect_google_analytics_service_account",
headers={
"Content-Type": "application/json",
},
json={"clientId": "string", "propertyId": "string"},
)
data = res.json()Go
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
req, _ := http.NewRequest("POST", "https://seolyticize.com/api/v1/tools/connect_google_analytics_service_account", strings.NewReader(`{"clientId":"string","propertyId":"string"}`))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://seolyticize.com/api/v1/tools/connect_google_analytics_service_account');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"clientId":"string","propertyId":"string"}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;Ruby
require 'net/http'
require 'uri'
uri = URI('https://seolyticize.com/api/v1/tools/connect_google_analytics_service_account')
req = Net::HTTP::Post.new(uri)
req['Content-Type'] = 'application/json'
req.body = '{"clientId":"string","propertyId":"string"}'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(req)
end
puts res.bodyJava
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpRequest.BodyPublishers;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://seolyticize.com/api/v1/tools/connect_google_analytics_service_account"))
.header("Content-Type", "application/json")
.method("POST", BodyPublishers.ofString("{\"clientId\":\"string\",\"propertyId\":\"string\"}"))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());Responses
200 The tool's result, under
data.Example
{
"data": {}
}Schema
datarequired400 The body was not JSON or did not match the tool's input schema.
Example
{
"error": "string"
}Schema
errorstringrequiredA sentence written for the caller. Internal failures are reduced to 'The request could not be completed.' and never carry detail.
401 No key, or a key that is unknown or revoked.
Example
{
"error": "string"
}Schema
errorstringrequiredA sentence written for the caller. Internal failures are reduced to 'The request could not be completed.' and never carry detail.
403 The key's role does not permit the tool, or the key may not reach the named client.
Example
{
"error": "string"
}Schema
errorstringrequiredA sentence written for the caller. Internal failures are reduced to 'The request could not be completed.' and never carry detail.
404 No tool by that name.
Example
{
"error": "string"
}Schema
errorstringrequiredA sentence written for the caller. Internal failures are reduced to 'The request could not be completed.' and never carry detail.
422 A well-formed request the product declined, with the reason — a duplicate name, a plan limit, nothing configured to run.
Example
{
"error": "string"
}Schema
errorstringrequiredA sentence written for the caller. Internal failures are reduced to 'The request could not be completed.' and never carry detail.
429 This key has used its window.
Example
{
"error": "string"
}Schema
errorstringrequiredA sentence written for the caller. Internal failures are reduced to 'The request could not be completed.' and never carry detail.
500 The request could not be completed.
Example
{
"error": "string"
}Schema
errorstringrequiredA sentence written for the caller. Internal failures are reduced to 'The request could not be completed.' and never carry detail.
Updated