Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(marketing): stabilize search performance pagination (#113321)

Javier Bahamondeseae61c01177c
diff --git a/docs/internal/marketing-source-suggestions.md b/docs/internal/marketing-source-suggestions.md
index 5f65fb7f35b6..d46d2c6d7bf8 100644
--- a/docs/internal/marketing-source-suggestions.md
+++ b/docs/internal/marketing-source-suggestions.md
@@ -37,6 +37,16 @@ The current import provides spend, clicks, and impressions; platform-reported co
PostHog conversion goals still work through campaign attribution.
Ad-level reporting is unavailable because the connector does not import promoted-post statistics.
+## Search performance
+
+Keywords and queries includes paid keywords from ad platforms and organic queries from Google Search Console.
+Search Console requires a synced `search_analytics_by_query` or `search_analytics_by_query_page` table; the integration and paid/organic filters determine which sources appear.
+Each search table has a reload control and query duration.
+Pagination stays within the table without scrolling the scene, and changing between keywords and landing pages starts on page 1.
+Tables with more than ten results reserve consistent space for values and comparisons and keep room for ten rows on shorter pages.
+Tables with ten results or fewer keep their compact layout without reserved space.
+Use the page selector to jump directly to a page, or the arrows to move one page at a time.
+
## Bing Ads landing pages
Search performance includes Bing Ads in the Landing pages view.
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 2a590233d838..4d146ff5c5aa 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -11947,77 +11947,81 @@ snapshots:
scenes-app-marketing-analytics-search-performance--awaiting-sync--light:
hash: v1.k794b7964.1e682849cf3ff944c156abae9e4a762cbfb4a6067a3a28b92f0a900f62d781cd.2NWULrKTIdOxwZwMcOOWiXaakv5AQ5GNtbiACz2FzyU
scenes-app-marketing-analytics-search-performance--comparison--dark:
- hash: v1.k794b7964.de77865816c9cd27388687b2ec104f69a0940f558f33eeb71209f88972fb39e6.myT4UFo_7h3EJKHq1MYkev21vFTvp4RNgINtO1ksSq4
+ hash: v1.k794b7964.da4a489bbd60a01ac3278d616783a98563d38e3430ff96427a0e1057cd417393.VLQXGho9dJX3L0DgD12LtAhADq6a2m-xzF4DK02BjZg
scenes-app-marketing-analytics-search-performance--comparison--light:
- hash: v1.k794b7964.3a07a766dc08ac96ba406cb6153891d8f10b584310988fe5b3b32e4a811913ca.kX6QW9MEMPD1GbEM0t9RqInZmYf_NxROL-dajwye5R0
+ hash: v1.k794b7964.bcfe64356d716b21113f8814f0ec8b9cf32dcab36c1b837873f782764e0f3650.JJA1JqMHNbu5xeMZ867GXPIrPPFmWED402YuC-wPnsc
scenes-app-marketing-analytics-search-performance--connected--dark:
- hash: v1.k794b7964.7e7cba08fd2a92d8d592f8b94029add87188f12456022474be3ffd55062c8f22.N-4ZkymPxMsT663wMCBB7Ii29kEfTEDcE3ZCYfKzG2M
+ hash: v1.k794b7964.fed77229a94d34e7b474d6e196843ef43dede3929bb999a38ac629529f612d89.nf0LcTGUhk75Lw9Bxf6WI0SRRlf_zN278kCKWKRW-1Q
scenes-app-marketing-analytics-search-performance--connected--light:
- hash: v1.k794b7964.bd0086bce9bb1022159713ae37406c793dbf66e7566874f54a2e0cc0e4018147.h_kAiuk7GSEAW0fPzPdeVlkWtxcjIb8-rCRiaLJgURo
+ hash: v1.k794b7964.685d98322b8bf4940eb384317b070ae7026e82be665b3848ed6bdcd3d59224e9.UExTHm9fzNvTY9g9t31gWz3TBGacLRm2kj_OhbRiamQ
scenes-app-marketing-analytics-search-performance--empty--dark:
- hash: v1.k794b7964.34461d7967f4b8ce1ffd14ec9dcb15417e2c7c97009986b68db1f95bd5c7a06e.uUv6tzgsVcG49QjJBcE7cLiqZ1xBdttc79pMmH5ipoU
+ hash: v1.k794b7964.7361623ddfa744d10e1f69d91ed046cfed96397bed5900c9b5040838e03c8421.BqO8M90qUA2SQEH01p7koER1Lf1gC_COTYB1e4cAbxI
scenes-app-marketing-analytics-search-performance--empty--light:
- hash: v1.k794b7964.e2eb2d1d5fd47902bd3d051bb36865f72f7b4c29fe41503b30ba9742a12be1db.WcPH098LFmfS_UEVPe1pWom_AB4rOMCEKqL8-sBDG3g
+ hash: v1.k794b7964.3c644577458d384fdbf2b4283a1b008b11bdcda089a9564c50ef6fb5aea32e65.fmuaZYzsXZBv8WcNrPIyLjH1iEPG0yy_iWghDF6reWQ
scenes-app-marketing-analytics-search-performance--empty-google-ads--dark:
- hash: v1.k794b7964.c9b5ec6c2246b144b2f26cd1c523528a973264c7f5f7858c6463f386fd30ea3e.3tVsUjDGQzl71QxRX9IuINaZuRmIZ13uWNGEmFSXuXU
+ hash: v1.k794b7964.0f6481d56f5c834dc8f2ef6b44da971336ff939111e0321062352deea3fb0fd4.SJ6RAScjMk_PlLOSqw1FIvRTsBCEPWwCXkFeUlNuCDg
scenes-app-marketing-analytics-search-performance--empty-google-ads--light:
- hash: v1.k794b7964.005ecc67553df9f22035aac5510de167d408e22dab217e11a9d2943208c27340.YV6Ds9HZ81jq1GMORJU7Ba97jIMaiDzQdribdFSTK3I
+ hash: v1.k794b7964.6c210113b336340aa2d909ad0476433fd34955ca9eb162abdd98be5e5d1f83b6.QBHwog3p1CZJG9k5hq7HryES4_XydV0ZN18xsqC5qhU
scenes-app-marketing-analytics-search-performance--empty-organic--dark:
- hash: v1.k794b7964.5064ba1b4ed115f916aaa26730dfdaa98544b2e007560f682562e8809f19d2f8.wX92jPGk1eiM18RdObXQH0A_KxwPzQMVv9i1zGUr-AQ
+ hash: v1.k794b7964.d8b9d9dc91ad11c6140e5d1f8abeafae5fcd3c04cdf540a5c68bee4f3eb91efd.qQPQzDTrd47vIOq0wlEp3-y-xHfNhKhpOQI38UN5k-M
scenes-app-marketing-analytics-search-performance--empty-organic--light:
- hash: v1.k794b7964.4b63d3789d298fdf1c3b0821abf21d09d8dab2e94b3ffd5777b2c82ea60aacb7.22ODULeUbrPxnek6uiaZfciJ8X293GeWC36sks4M5P8
+ hash: v1.k794b7964.c5637a6fd1601c5e0898097d5737198f0732b5ec61678bc7494c8d873edcd205.YwB0Plncvous1yGLtPdic3wjrjIyzppw4tUWSNS3a4o
scenes-app-marketing-analytics-search-performance--filtered-empty--dark:
- hash: v1.k794b7964.5a9f71b9e8dc9daea87186d4cd050d8dd117ea189fabdc7a5f3db1b201c8eca7.9EVyaH52ohgljYugkbLOfanaz8ATeZIrH79ckbpDhyc
+ hash: v1.k794b7964.6d4eaab46788b1f1e2e9a093a93343a26fd019c3faadc7cc9d48b012b015949d.pO4k8JGzVkm9AwIqKs2m881lL5-UJgPlMEleFZ-rOt4
scenes-app-marketing-analytics-search-performance--filtered-empty--light:
- hash: v1.k794b7964.3b2e75a06d33ff24f87e5ec37d3b43a6f7b6b8a415f29f279da4374ab6da9203.6bY2c2Mv49_GgRBPd4W1iVP55YB4Uh2suIHNOGuvIB8
+ hash: v1.k794b7964.7a749b50debb64abf43def8dd705bbc026e5ab0b5b1ca13e6728efb6bdfca1d1.0nGet0e8mq_5ok7RXQREG3gkeBUADKYVrnZJ7o7j9yQ
scenes-app-marketing-analytics-search-performance--flag-off--dark:
hash: v1.k794b7964.0abe2d58ee70ac24582205caacee0e0b09831b9f04687d5ee1d9ec28f7f99be8.23pCSt9pA4N6R0id0jXh6Z0GpGSmmifTz1Ur090dRnY
scenes-app-marketing-analytics-search-performance--flag-off--light:
hash: v1.k794b7964.9336af8fdbf0c10e0dadbdc398517b3856ad19eae7ff0f580ddd507e4202b57b.92lmvS4XqmLPpRq2h7e7R_7p8x2ZpdvIaIAKZRL4lQU
scenes-app-marketing-analytics-search-performance--landing-pages--dark:
- hash: v1.k794b7964.74656d8364625a9f6b442baa2ad5507a244323919fb63d37dc2342a5a1bfdab5.wauw1gWSMZQPmDxATPiyd5Kw-cqdLg89C0CDPzEW9GA
+ hash: v1.k794b7964.289770d75deebad839afe43097292762614598ad52551dd619598f2706773f45.ChEsO2JPUZS_jiF3HcQZyICjrL8KLQM_QBKHj0pdytk
scenes-app-marketing-analytics-search-performance--landing-pages--light:
- hash: v1.k794b7964.bc30f3c78c9a225f143ba3378e886536265d6c9c8916944b3f33de3a4482de73.PIXCck6pjUZmQlVCqW1WIErlkXU7E3W_JTl2IZnlnYc
+ hash: v1.k794b7964.01c9c7484939a58b55a3664f2ed87f903f5e5dd5636c31918b6efe31253642b5.3dfRb_8K5xRRGzR2uHJ5jUWCYaVOmxVVUs9LKAiujyg
scenes-app-marketing-analytics-search-performance--legacy-scene--dark:
- hash: v1.k794b7964.bb37add7475d921f29b8d578a8a879f61054e69cac604bf6039c2a267ade6683.ng8ac4fpTBVCX8us-xZvC9a2gWYq61EblkjLr0Ov9yI
+ hash: v1.k794b7964.79803ad82b7c9d0112e8915230cc17bb0fb627f450f8b3212dfa5398d079465d.dM0uXKDYjEZqKXq4eZ7QcLK2wP3NAYjmmkl45CU0G7Q
scenes-app-marketing-analytics-search-performance--legacy-scene--light:
- hash: v1.k794b7964.ed9aae37af26ad5eca014aa247a8fee19e3b920814f3291f13412e26fc057ee4.BUdBngrX0abFjXJPvOtQBxDDfkbnDe_49lhgLwgdvnc
+ hash: v1.k794b7964.15c6cfa3a0f734a07073c4cbff5997267408a1a2d74ec9f7f3bea24cec3957ad.CZzg97JJMY24EiK5gti3sWvzSK_t2jNaiO5M5dJEPF8
scenes-app-marketing-analytics-search-performance--loading--dark:
- hash: v1.k794b7964.4ba1991cfbec1d2f9021f4136422b78677c16c06e82e842ada1675285697ba17.PEoFpBSF83Z_XSvI-3lbtBiiR88CkBMDyeYIGfwRBAU
+ hash: v1.k794b7964.e8b3da971882e1673916af543e9f93576a35214e978f5351506fab59d673003e.LN9Bi8RdQqlOoo4DBKqtjgOEgVlVIjL2BE6K5AZGLH0
scenes-app-marketing-analytics-search-performance--loading--light:
- hash: v1.k794b7964.6fa7ec534c2d437ef8e4b3eea0cf9a4dae6f563d83845c244e7606713ad45ad2.q3RCwJnX9_AvFC--GxFS1hzZE_yBb6ZYaZN13FGskqk
+ hash: v1.k794b7964.9bcc8a3217b226695e87b8246bf586da01f455a1149ee158e34dfbcc64306cb5.Nriy1X-7lsMBQR4lMZfCWHuj1m1SMAndmYBOdSaYiZc
scenes-app-marketing-analytics-search-performance--mixed-with-position--dark:
- hash: v1.k794b7964.e681bf200d6449ce85ffd47136501877275e2e1a97d5e123fd83115530655530.JMAKwF3_NHTX2GUk5tltwknAFGkQfJ9hMzRrkckKTB8
+ hash: v1.k794b7964.ef717d85440987bfbc784867e3ba4b2c491970fa77550b3ab942fb4975dcf866.LQyQ5KtbFtklDsJ8gE93mdQ0yRip2buA4XZNkHNAgDo
scenes-app-marketing-analytics-search-performance--mixed-with-position--light:
- hash: v1.k794b7964.6d20b67a5a88bf169da70120076817051563636d6af8da313684c073f6566340.CXgPKeJ3XF6HTb5g-UtwebIrLdSHaf4C2sMoNXgsCjo
+ hash: v1.k794b7964.8889fadec986fe25371f5bd0dc2050cd842f1e36a83553c41c4e711280c3edce.FaPb9-ILhVXPSALNNIMhLbYIeeHgzD89eDF2976cj44
scenes-app-marketing-analytics-search-performance--narrow--dark:
- hash: v1.k794b7964.c5787918b5a15cda4554b6aecfc2698d055071431c3f5b7840260d729bf17a8e.qVa2781gXbGtsKtYdDOEWYD25JdqPFBhA6NyxMm8I4A
+ hash: v1.k794b7964.bde1f1e8363ddf5f995c027fc7bb573f980e19dc392013968b65a002a933cfca.eJhwMI5ucoT8b5Jea3q3aMsKpiFUmp8dZZEU_MxjjrQ
scenes-app-marketing-analytics-search-performance--narrow--light:
- hash: v1.k794b7964.f637172b9288f0dfc71ca19ab958b18e1753555fddad99bbc9ad4b86e31ce4bb.8VLmbtNtwb_RGD6pNLkxbn7xrq4iOiw-mEO3w1AXtU4
+ hash: v1.k794b7964.85156ee128bad45622b2629a8b060d5dca86beea088a63a3ba04e1542c9aca79.Z0_KMaRMswpz6kiy3pLenU2tGdkX0DujGrB2h_nHbDo
scenes-app-marketing-analytics-search-performance--new-dashboard-flag-off--dark:
hash: v1.k794b7964.7adfc0ee89093703b8e923935870475615161314419fa409f03a59f9de5ec90b.6AeZyZLr78BXMkf-QvQSLQv7xF5-EpIyAwQSVD55YG4
scenes-app-marketing-analytics-search-performance--new-dashboard-flag-off--light:
hash: v1.k794b7964.2502d21dc38a51fef502b7ef452df680896462b29284847d1d107a7c0daf8727.nDQD9ooWp2VeSndPJnTKI4DVAZY5WNbdi41Y_vSBqYM
scenes-app-marketing-analytics-search-performance--new-dashboard-scene--dark:
- hash: v1.k794b7964.6f1782e7c5229d63d5f7d36814dd1bfc5885a9cc6fc446c3cc8e67a5f31cfef2.ewGGnU-9lX8xwoaZ5fIrOVLZtAgWYg8VIl6O8fokk6g
+ hash: v1.k794b7964.fc711c95950ca75ea72227bf5e456cddc49d332363f865c79de97180678ebc8f.CmUxds9gU22ruBIr7yDyZF0HLfDM3SgwyDGnEtevcsw
scenes-app-marketing-analytics-search-performance--new-dashboard-scene--light:
- hash: v1.k794b7964.a45903284339f8bb1ce0d5961c4b149f7fddb612e6cecd97274d0bd1bc44414f.3JkCMm6isH5rCrza94wbUfse55oec-NwYggjmx_s4do
+ hash: v1.k794b7964.86b09107dfff85bc5f3bfc9f02cf1f2768cfe9520fe264c4f32e29a841d9640f.rFANw9dORBZxXQr4akkqk0kRIJCWQe_Em3ffDtw22ac
scenes-app-marketing-analytics-search-performance--not-connected--dark:
hash: v1.k794b7964.fc45f91fd10720c94e64d84bd64d043e472d35c7be2a2c813f98a627fbbd93be.OvmqVf3mYSyJ_wXsOKvp-LWwhymTTD6MbSikTmLg564
scenes-app-marketing-analytics-search-performance--not-connected--light:
hash: v1.k794b7964.d26e073f6322a6a5408b4b612361749f47d3b4cba38a82caf6210215db7b339a.c0EL08UuZQQZ3H5Euck3vSNLJSImyrOkGtYHoZOLzH4
scenes-app-marketing-analytics-search-performance--only-google-ads--dark:
- hash: v1.k794b7964.5e99b1ab76b75bebe10c2fca4c9967c1f8cb88d51135c3dab693d6543eae552f.KJGtm4WW3yiaCLSEKmiv-1fK4NT7OtY46UitdFbHDIo
+ hash: v1.k794b7964.dbc748f51f11da69156a9d152c1b87f2cbc8d34e17777bcef40df89bb9e3f579.TQGapnKNvsxpS6Q9G4KQ83kG3RsrqCEvpefof05-G8g
scenes-app-marketing-analytics-search-performance--only-google-ads--light:
- hash: v1.k794b7964.5a146e648c99a7640f2ba606c460262fa0f21382418a3e31610ff01f2ae3c7a7.fO49F5DmX_6-6z_SBYOyObOYuURgpqCvd1lvP8K4YS8
+ hash: v1.k794b7964.8af18d07a7e2bd7e3328bd71225fb3f2ed7e76e3a748b51610d08f4ef31e5eb6.rLarOIv0GghPfWGPJs19PdgfziIgLTodLQDszMgPIkg
scenes-app-marketing-analytics-search-performance--organic-detail--dark:
- hash: v1.k794b7964.fe5f6ebd2a1231c17655affa0d186614cde3df91815e14d11f911541985e4f83.BOf_tOoVHYYhLKTXqW-FtKMnM6RsvxZkkxYxRwFKO6M
+ hash: v1.k794b7964.590ef075a7d1ce48e0d9dfd82e32c27f11f27a932b582ebd9b5f84e61c4b23e7.OJbK-8ImktYE25NEH7-dwU1yqCzcSKTgJ3DaM5v_nHI
scenes-app-marketing-analytics-search-performance--organic-detail--light:
- hash: v1.k794b7964.b6cc067106fba330646ceecf9d0b45682e1ae150e5d10ae7faee2020b27768ef.4wdqjU_68A79aSSZcYCmkZoI5TOSoxuZSXkwRZYDutA
+ hash: v1.k794b7964.a5478e8d78aa10ec347237992737fbd38942d2d65cc0914243bc130aca52dfcb.Z7H4tw2dzbkAkNTAz8kQYTZBcI-4Yvy4RxcZaPZTm0Y
scenes-app-marketing-analytics-search-performance--organic-traffic--dark:
- hash: v1.k794b7964.73bd26e879d93440854f347ed6d2ff5158495ccbd933398588abbf8032945275.MTHT41OlrtA2hiTk_55qnI4eS6LEkM7ku2j_EUlZ_BE
+ hash: v1.k794b7964.7ba41e4f8a805ede72988abf68da5ca71fdd5ea49e54ae1a1429395b0d5395c8.spzxSw17uk9MAi9eoFImUrzH8Anni36d5WJz6RkVNZ4
scenes-app-marketing-analytics-search-performance--organic-traffic--light:
- hash: v1.k794b7964.bee955a5a256a88130f02056f26e41c3f6a7d01af3b6db9e6c8f584ae71a4916.N8iyGqfll5D_HYoEPwcK2vlTnY50f56Il6axuJ6mLVY
+ hash: v1.k794b7964.b489f95489321db0b4880bab8e0c7d6660751c66b6ad97a22e412a8aefb61f81.2jCSJbAJrEZ2T1LLtgwtgcp_f6pvcKzSxBidM7FPYnE
+ scenes-app-marketing-analytics-search-performance--pagination--dark:
+ hash: v1.k794b7964.e9e58780ceb0c43662f398a8c9f3f384594019c76ed30cff1455b38e9f829c4c.Q2-h9ci1VnBriXD9zUqh7p8YlVxgpapD8S2rJPqNwrY
+ scenes-app-marketing-analytics-search-performance--pagination--light:
+ hash: v1.k794b7964.cf0100b7d5f64a9025ec09043be81637b4c6dfe20119fdce9c78bcb559d3c055.E1u-Ch73ICFOr1Hxy-jpjKL6jeT8KMtshGU_NI2jmk0
scenes-app-marketing-analytics-search-performance--query-error--dark:
hash: v1.k794b7964.a5419c8a09ca30185fc876c1631efb87ce8d017398ebcced2fa8d652e21f2384.GT50JRsrPVWV-OG5VIDpTgX8_wzYvIMrjseLhp24jxY
scenes-app-marketing-analytics-search-performance--query-error--light:
@@ -12027,9 +12031,9 @@ snapshots:
scenes-app-marketing-analytics-search-performance--sources-error--light:
hash: v1.k794b7964.159cf8b9647d98ad2c63ce40109229e9ffd0352de1d98167b9446794a947ff21.gupk_qTVysxLVkierQb3CrLvQ4-AtOFEXoQ4yuxHtlU
scenes-app-marketing-analytics-search-performance--stale-aggregate--dark:
- hash: v1.k794b7964.46d7f9bf54008e910deb07c593b94f52dd4c2b4ed4b29a57ac0caec2eb24819f.J-z6BD0oFq5-WRV9lJv3yc1IX0LBjCEAOKlW-2zeQQU
+ hash: v1.k794b7964.226342e45a774583025c9988c51e0b775fa69aa4035467373e672c3265f9d895.p0Bym6Yw58dJHLXxXSZMVOcDkTFQ3KYxEwnBTIN6Nkk
scenes-app-marketing-analytics-search-performance--stale-aggregate--light:
- hash: v1.k794b7964.81cfee0cb23c6efe920258b66ff25585e1ba4f40dbab428bf0d8f07826dc81bf.tZDfCQ37-cegGm-Zm6GWo942xnmXkZHwbdFsHdzAGQE
+ hash: v1.k794b7964.83f38c49b6c2036cca2f9307418d58a0dd9e3b7063bde6fc6aa38b3bc5d58704.X9WJX0-nqOFB39GZu5dJNnpecnjb9gwyPVlCeKI8oVw
scenes-app-marketing-analytics-search-performance--unavailable-sources--dark:
hash: v1.k794b7964.f6115da5bb35e65e9e48dda2f2caa8c3ea2c5d29b2e820f0a151f544f9d9c6c6.JiUwR7QskSO2lnI3Iq0P_NclgAPQye-fndfCTAjqDsQ
scenes-app-marketing-analytics-search-performance--unavailable-sources--light:
diff --git a/frontend/src/lib/lemon-ui/PaginationControl/PaginationControl.tsx b/frontend/src/lib/lemon-ui/PaginationControl/PaginationControl.tsx
index 78c5cf8f5c97..f7223703d068 100644
--- a/frontend/src/lib/lemon-ui/PaginationControl/PaginationControl.tsx
+++ b/frontend/src/lib/lemon-ui/PaginationControl/PaginationControl.tsx
@@ -5,6 +5,7 @@ import clsx from 'clsx'
import { IconChevronLeft, IconChevronRight } from '@posthog/icons'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
+import { LemonSelect } from 'lib/lemon-ui/LemonSelect'
import { PaginationState } from './types'
@@ -51,6 +52,19 @@ export function PaginationControl<T>({
? `${currentEndIndex} of ${entryCount}${entryCountIsLowerBound ? '+' : ''} ${entryCount === 1 ? nouns[0] : nouns[1]}`
: `${currentStartIndex + 1}-${currentEndIndex} of ${entryCount}${entryCountIsLowerBound ? '+' : ''} ${nouns[1]}`}
</span>
+ {pagination && !pagination.controlled && pagination.showPageSelector && pageCount && currentPage ? (
+ <LemonSelect
+ size="small"
+ aria-label="Go to page"
+ data-attr="pagination-go-to-page"
+ value={currentPage}
+ onChange={setCurrentPage}
+ options={Array.from({ length: pageCount }, (_, index) => ({
+ value: index + 1,
+ label: `Page ${index + 1} of ${pageCount}`,
+ }))}
+ />
+ ) : null}
<LemonButton
icon={<IconChevronLeft />}
aria-label="Previous page"
diff --git a/frontend/src/lib/lemon-ui/PaginationControl/types.ts b/frontend/src/lib/lemon-ui/PaginationControl/types.ts
index ed5a9f9f0162..bc361edb825b 100644
--- a/frontend/src/lib/lemon-ui/PaginationControl/types.ts
+++ b/frontend/src/lib/lemon-ui/PaginationControl/types.ts
@@ -9,6 +9,7 @@ export interface PaginationAuto extends PaginationBase {
controlled?: false
/** Size of each page (except the last one which can be smaller). */
pageSize: number
+ showPageSelector?: boolean
}
export interface PaginationManual extends PaginationBase {
diff --git a/products/marketing_analytics/frontend/search/SearchPerformanceTab.stories.tsx b/products/marketing_analytics/frontend/search/SearchPerformanceTab.stories.tsx
index 988960796386..95147071be03 100644
--- a/products/marketing_analytics/frontend/search/SearchPerformanceTab.stories.tsx
+++ b/products/marketing_analytics/frontend/search/SearchPerformanceTab.stories.tsx
@@ -265,8 +265,69 @@ type Story = StoryObj<typeof meta>
export const Connected: Story = {
parameters: { pageUrl: `${urls.marketingAnalyticsApp()}?tab=ad-performance&compare=false` },
}
+export const Pagination: Story = {
+ parameters: {
+ pageUrl: `${urls.marketingAnalyticsApp()}?tab=ad-performance&compare=true`,
+ msw: {
+ mocks: {
+ post: {
+ '/api/environments/:team_id/query/MarketingAnalyticsSearchQuery/': async ({
+ request,
+ }: {
+ request: Request
+ }) => {
+ const { query } = (await request.json()) as { query: MarketingAnalyticsSearchQuery }
+ return [
+ 200,
+ {
+ results: Array.from({ length: 23 }, (_, index) => ({
+ ...ROWS[index % ROWS.length],
+ previous: {
+ clicks: 50,
+ impressions: 1000,
+ ctr: 0.05,
+ cost: 100,
+ conversions: 2,
+ cpc: 2,
+ cpa: 50,
+ position: 5,
+ },
+ keyword: `Example keyword ${index + 1}`,
+ page: query.breakdown === 'page' ? `https://example.com/page-${index + 1}` : null,
+ })),
+ },
+ ]
+ },
+ },
+ },
+ },
+ },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement)
+ await canvas.findByText('1-10 of 23 entries')
+ await userEvent.click(canvas.getByRole('button', { name: 'Next page' }))
+ await canvas.findByText('11-20 of 23 entries')
+ const nextButton = canvas.getByRole('button', { name: 'Next page' })
+ const arrowTop = nextButton.getBoundingClientRect().top
+ await userEvent.click(canvas.getByRole('button', { name: 'Go to page' }))
+ await userEvent.click(await within(canvasElement.ownerDocument.body).findByText('Page 3 of 3'))
+ await canvas.findByText('21-23 of 23 entries')
+ await expect(canvas.getByRole('button', { name: 'Next page' }).getBoundingClientRect().top).toBe(arrowTop)
+ await userEvent.click(canvas.getByRole('button', { name: 'Landing pages' }))
+ await canvas.findByText('1-10 of 23 entries')
+ await userEvent.click(canvas.getByRole('button', { name: 'Next page' }))
+ await canvas.findByText('11-20 of 23 entries')
+ await userEvent.click(canvas.getByRole('button', { name: 'Keywords and queries' }))
+ await expect(await canvas.findByText('1-10 of 23 entries')).toBeVisible()
+ },
+}
export const Comparison: Story = {
parameters: { pageUrl: `${urls.marketingAnalyticsApp()}?tab=ad-performance&compare=true` },
+ play: async ({ canvasElement }) => {
+ await within(canvasElement).findByText('Google Search Console')
+ const table = canvasElement.querySelector('.SearchPerformanceTable .LemonTable__content')!
+ await expect(table.getBoundingClientRect().height).toBeLessThan(600)
+ },
}
export const MixedWithPosition: Story = {
...Comparison,
diff --git a/products/marketing_analytics/frontend/search/SearchPerformanceTable.scss b/products/marketing_analytics/frontend/search/SearchPerformanceTable.scss
new file mode 100644
index 000000000000..df4a0168e9a2
--- /dev/null
+++ b/products/marketing_analytics/frontend/search/SearchPerformanceTable.scss
@@ -0,0 +1,23 @@
+.SearchPerformanceTable--paginated {
+ .LemonTable__content {
+ display: flex;
+ flex-direction: column;
+
+ // Reserve ten rows so the final page keeps navigation in place.
+ min-height: 48rem;
+ }
+
+ .PaginationControl {
+ margin-top: auto;
+ }
+
+ .SearchPerformanceTable__metric > span {
+ flex-direction: column;
+ gap: 0;
+ align-items: flex-end;
+ }
+
+ tbody td {
+ height: 4rem;
+ }
+}
diff --git a/products/marketing_analytics/frontend/search/SearchPerformanceTable.tsx b/products/marketing_analytics/frontend/search/SearchPerformanceTable.tsx
index 67189f746f7d..72286d93c21d 100644
--- a/products/marketing_analytics/frontend/search/SearchPerformanceTable.tsx
+++ b/products/marketing_analytics/frontend/search/SearchPerformanceTable.tsx
@@ -1,10 +1,15 @@
-import { useActions, useValues } from 'kea'
+import './SearchPerformanceTable.scss'
+
+import clsx from 'clsx'
+import { BindLogic, useActions, useValues } from 'kea'
import { LemonButton, LemonTable } from '@posthog/lemon-ui'
import { MARKETING_ANALYTICS_DATA_COLLECTION_NODE_ID } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsTilesLogic'
import { dataNodeLogic } from '~/queries/nodes/DataNode/dataNodeLogic'
+import { ElapsedTime } from '~/queries/nodes/DataNode/ElapsedTime'
+import { Reload } from '~/queries/nodes/DataNode/Reload'
import {
CurrencyCode,
MarketingAnalyticsSearchMetrics,
@@ -66,145 +71,162 @@ export function SearchPerformanceTable({
)
}
return (
- <LemonTable<MarketingAnalyticsSearchRow>
- size="small"
- tableLayout="fixed"
- className="@max-[40rem]:[&_col:nth-child(2)]:w-10 @max-[40rem]:[&_th]:px-2 @max-[40rem]:[&_td]:px-2 @max-[40rem]:[&_th_svg]:hidden @max-[40rem]:[&_.sorting-indicator]:hidden"
- dataSource={responseLoading ? [] : rows}
- loading={responseLoading}
- loadingSkeletonRows={5}
- rowKey={(row) => JSON.stringify([row.keyword, row.page, row.platform, row.matchType, row.currency])}
- pagination={{ pageSize: 10 }}
- useURLForSorting={false}
- emptyState={emptyState}
- columns={[
- {
- title: query.breakdown === 'page' ? 'Landing page' : 'Keyword or query',
- key: 'keyword',
- width: '24%',
- render: (_, row) => (
- <div className="min-w-0">
- {onSelect && (row.page || row.keyword) ? (
- <LemonButton type="tertiary" size="xsmall" noPadding onClick={() => onSelect(row)}>
- <span className="block truncate text-link" title={row.page ?? row.keyword ?? ''}>
- {row.page ?? row.keyword}
+ <BindLogic logic={dataNodeLogic} props={logic.props}>
+ <div className="flex flex-wrap items-center gap-2 py-2">
+ <Reload />
+ <ElapsedTime />
+ </div>
+ <LemonTable<MarketingAnalyticsSearchRow>
+ size="small"
+ tableLayout="fixed"
+ className={clsx(
+ 'SearchPerformanceTable @max-[40rem]:[&_col:nth-child(2)]:w-10 @max-[40rem]:[&_th]:px-2 @max-[40rem]:[&_td]:px-2 @max-[40rem]:[&_th_svg]:hidden @max-[40rem]:[&_.sorting-indicator]:hidden',
+ { 'SearchPerformanceTable--paginated': rows.length > 10 }
+ )}
+ dataSource={responseLoading ? [] : rows}
+ loading={responseLoading}
+ loadingSkeletonRows={10}
+ rowKey={(row) => JSON.stringify([row.keyword, row.page, row.platform, row.matchType, row.currency])}
+ key={JSON.stringify(query)}
+ pagination={{ pageSize: 10, useUrl: false, showPageSelector: true }}
+ scrollToTopOnPageChange={false}
+ useURLForSorting={false}
+ emptyState={emptyState}
+ columns={[
+ {
+ title: query.breakdown === 'page' ? 'Landing page' : 'Keyword or query',
+ key: 'keyword',
+ width: '24%',
+ render: (_, row) => (
+ <div className="min-w-0">
+ {onSelect && (row.page || row.keyword) ? (
+ <LemonButton type="tertiary" size="xsmall" noPadding onClick={() => onSelect(row)}>
+ <span
+ className="block truncate text-link"
+ title={row.page ?? row.keyword ?? ''}
+ >
+ {row.page ?? row.keyword}
+ </span>
+ </LemonButton>
+ ) : (
+ <span
+ className="block truncate"
+ title={row.page ?? row.keyword ?? 'Keyword unavailable'}
+ >
+ {row.page ?? row.keyword ?? 'Keyword unavailable'}
</span>
- </LemonButton>
- ) : (
- <span
- className="block truncate"
- title={row.page ?? row.keyword ?? 'Keyword unavailable'}
- >
- {row.page ?? row.keyword ?? 'Keyword unavailable'}
+ )}
+ <span className="text-xs text-secondary block truncate">
+ {row.platform === 'GoogleSearchConsole'
+ ? 'Organic search'
+ : [row.matchType, row.currency].filter(Boolean).join(' · ')}
+ </span>
+ </div>
+ ),
+ },
+ {
+ title: <span className="SearchPerformanceTable @max-[40rem]:sr-only">Platform</span>,
+ key: 'platform',
+ render: (_, row) => (
+ <span
+ className="flex items-center gap-1 min-w-0"
+ title={SEARCH_PLATFORM_LABELS[row.platform]}
+ >
+ <SourceIcon type={row.platform} size="xsmall" disableTooltip />
+ <span className="hidden @min-[40rem]:inline truncate">
+ {SEARCH_PLATFORM_LABELS[row.platform]}
</span>
- )}
- <span className="text-xs text-secondary block truncate">
- {row.platform === 'GoogleSearchConsole'
- ? 'Organic search'
- : [row.matchType, row.currency].filter(Boolean).join(' · ')}
- </span>
- </div>
- ),
- },
- {
- title: <span className="@max-[40rem]:sr-only">Platform</span>,
- key: 'platform',
- render: (_, row) => (
- <span className="flex items-center gap-1 min-w-0" title={SEARCH_PLATFORM_LABELS[row.platform]}>
- <SourceIcon type={row.platform} size="xsmall" disableTooltip />
- <span className="hidden @min-[40rem]:inline truncate">
- {SEARCH_PLATFORM_LABELS[row.platform]}
- </span>
- </span>
- ),
- },
- ...metricKeys.map((metric) => ({
- title: (
- <span className="whitespace-normal wrap-anywhere">
- <span className="hidden @min-[40rem]:inline">
- {
- {
- clicks: 'Clicks',
- impressions: 'Impressions',
- ctr: 'CTR',
- cost: 'Cost',
- conversions: 'Conversions',
- cpc: 'CPC',
- cpa: 'CPA',
- position: 'Position',
- }[metric]
- }
</span>
- <span className="@min-[40rem]:hidden">
- {
+ ),
+ },
+ ...metricKeys.map((metric) => ({
+ title: (
+ <span className="whitespace-normal wrap-anywhere">
+ <span className="hidden @min-[40rem]:inline">
{
- clicks: 'Clicks',
- impressions: 'Impr.',
- ctr: 'CTR',
- cost: 'Cost',
- conversions: 'Conv.',
- cpc: 'CPC',
- cpa: 'CPA',
- position: 'Pos.',
- }[metric]
- }
- </span>
- </span>
- ),
- tooltip: {
- clicks: 'Clicks reported by the search source',
- impressions: 'Impressions reported by the search source',
- ctr: 'Clicks divided by impressions',
- cost: 'Spend in the ad account currency',
- conversions: 'Conversions attributed by the ad platform',
- cpc: 'Spend divided by clicks',
- cpa: 'Spend divided by conversions',
- position:
- 'Average position in organic Google search, weighted by impressions. Lower is better.',
- }[metric],
- key: metric,
- align: 'right' as const,
- sorter: (a: MarketingAnalyticsSearchRow, b: MarketingAnalyticsSearchRow) =>
- (a[metric] ?? -1) - (b[metric] ?? -1),
- render: (_: unknown, row: MarketingAnalyticsSearchRow) => {
- const value = row[metric] ?? null
- const money = metric === 'cost' || metric === 'cpc' || metric === 'cpa'
- const currency =
- row.currency && Object.values(CurrencyCode).includes(row.currency as CurrencyCode)
- ? (row.currency as CurrencyCode)
- : null
- return (
- <div>
- <ChangeValueCell
- value={value === null ? null : [value, row.previous?.[metric] ?? null]}
- compare={!!query.compareFilter?.compare}
- kind={
- metric === 'ctr'
- ? 'percentage'
- : money && currency
- ? 'currency'
- : metric === 'conversions' || metric === 'position' || money
- ? 'decimal'
- : 'number'
+ {
+ clicks: 'Clicks',
+ impressions: 'Impressions',
+ ctr: 'CTR',
+ cost: 'Cost',
+ conversions: 'Conversions',
+ cpc: 'CPC',
+ cpa: 'CPA',
+ position: 'Position',
+ }[metric]
}
- currency={currency ?? CurrencyCode.USD}
- reverseColors={
- metric === 'cost' ||
- metric === 'cpc' ||
- metric === 'cpa' ||
- metric === 'position'
+ </span>
+ <span className="@min-[40rem]:hidden">
+ {
+ {
+ clicks: 'Clicks',
+ impressions: 'Impr.',
+ ctr: 'CTR',
+ cost: 'Cost',
+ conversions: 'Conv.',
+ cpc: 'CPC',
+ cpa: 'CPA',
+ position: 'Pos.',
+ }[metric]
}
- />
- {money && row.platform !== 'GoogleSearchConsole' && (
- <span className="block text-xs text-secondary">
- {row.currency ?? 'Unknown currency'}
- </span>
- )}
- </div>
- )
- },
- })),
- ]}
- />
+ </span>
+ </span>
+ ),
+ tooltip: {
+ clicks: 'Clicks reported by the search source',
+ impressions: 'Impressions reported by the search source',
+ ctr: 'Clicks divided by impressions',
+ cost: 'Spend in the ad account currency',
+ conversions: 'Conversions attributed by the ad platform',
+ cpc: 'Spend divided by clicks',
+ cpa: 'Spend divided by conversions',
+ position:
+ 'Average position in organic Google search, weighted by impressions. Lower is better.',
+ }[metric],
+ key: metric,
+ align: 'right' as const,
+ sorter: (a: MarketingAnalyticsSearchRow, b: MarketingAnalyticsSearchRow) =>
+ (a[metric] ?? -1) - (b[metric] ?? -1),
+ render: (_: unknown, row: MarketingAnalyticsSearchRow) => {
+ const value = row[metric] ?? null
+ const money = metric === 'cost' || metric === 'cpc' || metric === 'cpa'
+ const currency =
+ row.currency && Object.values(CurrencyCode).includes(row.currency as CurrencyCode)
+ ? (row.currency as CurrencyCode)
+ : null
+ return (
+ <div className="SearchPerformanceTable__metric">
+ <ChangeValueCell
+ value={value === null ? null : [value, row.previous?.[metric] ?? null]}
+ compare={!!query.compareFilter?.compare}
+ kind={
+ metric === 'ctr'
+ ? 'percentage'
+ : money && currency
+ ? 'currency'
+ : metric === 'conversions' || metric === 'position' || money
+ ? 'decimal'
+ : 'number'
+ }
+ currency={currency ?? CurrencyCode.USD}
+ reverseColors={
+ metric === 'cost' ||
+ metric === 'cpc' ||
+ metric === 'cpa' ||
+ metric === 'position'
+ }
+ />
+ {money && row.platform !== 'GoogleSearchConsole' && (
+ <span className="block text-xs text-secondary">
+ {row.currency ?? 'Unknown currency'}
+ </span>
+ )}
+ </div>
+ )
+ },
+ })),
+ ]}
+ />
+ </BindLogic>
)
}