Skip to content

Instantly share code, notes, and snippets.

@boydnorwood
boydnorwood / Nozzle's Local SEO Dashboard SQL
Last active May 3, 2022 19:17
Query used to create a local seo dashboard in data studio from Nozzle data
--For Local Pack Dashboard: For generating Pages 1, 2, and 4 on the template
WITH
-- find the latest versioned keyword data
-- this can also be used to pin a query to an older version, good for static reports
latest_keyword_source_versions AS (
SELECT keyword_source_id, MAX(keyword_source_version_id) AS keyword_source_version_id
FROM nozzledata.localseodemocompany_localseodemoco.keywords
GROUP BY keyword_source_id
),
@boydnorwood
boydnorwood / gist:c2a53ee37727cce37d139e49cc3c4453
Last active January 26, 2022 05:36
Generate A List of the Top X results for a Project in your Nozzle Workspace
-- Nozzle data top 20 results csv export
WITH
latest_filtered_rankings AS (
SELECT AS VALUE
ARRAY_AGG(t ORDER BY inserted_at DESC LIMIT 1)[OFFSET(0)]
FROM nozzledata.nozzle_nozzleofficial.rankings t
WHERE requested >= '2022-01-01 00:00:00' AND requested < '2022-01-25 00:00:00'
GROUP BY ranking_id
),
@boydnorwood
boydnorwood / gist:e19086c77c477b8ad32f00d0c1247add
Last active March 21, 2024 08:28
SQL for generating a basic rankings report in Data Studio with data from your Nozzle workspace
--Top Ranking URLs Report for Nozzle.io
--Data Studio Template can be found here: https://datastudio.google.com/u/1/reporting/359d4414-0cd6-4da1-8df5-2c6908e0ddec/page/pyxcB
WITH
-- find the latest versioned keyword data
-- this can also be used to pin a query to an older version, good for static reports
latest_keyword_source_versions AS (
SELECT keyword_source_id, MAX(keyword_source_version_id) AS keyword_source_version_id
FROM nozzledata.nozzle_nozzleofficial.keywords
WHERE keyword_source_id=930701976723823