Create a client ID and secret on the developer settings page and save the secret for later use.
Get a temporary access token.
const PIRSCH_CLIENT_ID = ScriptProperties.getProperty('client_id'); | |
const PIRSCH_CLIENT_SECRET = ScriptProperties.getProperty('client_secret'); | |
function onOpen() { | |
var ui = SpreadsheetApp.getUi(); | |
ui.createMenu("Pirsch Analytics") | |
.addItem('Get Visitors', 'pasteVisitorsToSheet') | |
.addToUi(); | |
} |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>YouTube Pirsch Demo</title> | |
<!-- Add the Pirsch extended script to support page views and events. --> | |
<script defer src="https://api.pirsch.io/pirsch-extended.js" | |
id="pirschextendedjs" | |
data-code="YOUR_PIRSCH_CODE"></script> |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Vimeo Pirsch Demo</title> | |
<!-- Add the Pirsch extended script to support page views and events. --> | |
<script defer src="https://api.pirsch.io/pirsch-extended.js" | |
id="pirschextendedjs" | |
data-code="YOUR_PIRSCH_CODE"></script> |
function addLinks() { | |
const links = document.getElementsByTagName("a"); | |
for (const link of links) { | |
if (!link.hasAttribute("pirsch-ignore") && !link.classList.contains("pirsch-ignore")) { | |
addInternalLink(link); | |
} | |
} | |
} |
<p> | |
<a href="https://example.com">Link 1</a> | |
<a href="https://example.com/mountain">Link 2</a> | |
<a href="https://example.com/unreleated">Link 3</a> | |
<a href="https://example.com/sea">Link 4</a> | |
</p> | |
<script> | |
const keywords = [ | |
"sea", |
This step is only required if you use a client ID + secret. A single access key allows you to skip the step, but it cannot be used to read statistics as with the other method. For write-only clients, we recommend using an access key.
Replace the CLIENT_ID
and CLIENT_SECRET
in the body. The access token in the response will be valid for 15 minutes.
curl --location --request POST 'https://api.pirsch.io/api/v1/token' \
--header 'Content-Type: application/json' \
--data-raw '{