Issues
Issues copied to clipboard
Insight Editor: how to figure out TQL for referrer stats?
Insight ID: 949CCA32-B740-4A9A-BEB7-8FBA2DFA2C44
I want to add our top referrers to a custom web app dashboard.
Goal
So if 1 visitor at my personal page christiantietze.de click a link to the page that uses tracking, I expect this to show christiantietze.de/the/page/path: 1 somewhere.
Journey
I checked the signal that have been recorded. The type pageview has a "payload" of referrer. 👍
I interpret that list this way: aPageview.payload["referrer"] would return the referral string if aPageview is a pageview signal object, payload an attribute on this object with a dictionary-like structure, and the key "referrer" dereferences the appropriate content.
Not sure how to get there, though. (I miss auto completion to explore this, I realize :D)
I figured out that a "Top N Query" would fit. So I checked the example and copied stuff over until I got to this:
{
"aggregations": [
{
"name": "count",
"type": "count"
}
],
"dataSource": "telemetry-signals",
"dimension": {
"dimension": "referrer",
"outputName": "referrer",
"type": "default"
},
"granularity": "month",
"metric": {
"ordering": "version",
"type": "dimension"
},
"queryType": "topN",
"threshold": 1
}
It doesn't error-out anymore, so that's good.
Admittedly, I have no clue what "aggregations" do and what goes in there or what the default value "thetaSketch" means. :) Starting with that was a bit intimidating. I eventually found this: https://telemetrydeck.com/docs/tql/aggregators/ so I'm good for now. I believe, but the default didn't help 😅
Not sure how all the rest ties into this, though.
Semi-related: it'd be super nice if the documentation page would replace the content in-place without a full page reload because I need to scroll the table of contents manually every time and reorient myself. It's gotten quite long over the year :)