This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BlurImage, YouTube } from "@dub/ui"; | |
import { nFormatter } from "@dub/utils"; | |
import { Eye, UserCheck, Video } from "lucide-react"; | |
import { Suspense } from "react"; | |
export function YoutubeChannel({ id }: { id: string }) { | |
return ( | |
<Suspense fallback={<div className="not-prose grid gap-4"></div>}> | |
<YoutubeChannelRSC id={id} /> | |
</Suspense> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/controllers/graphql_controller.rb | |
class GraphqlController < ApplicationController | |
def execute | |
# Reading the `dclid` cookie | |
dclid = cookies[:dclid] | |
# Handle the GraphQL query | |
variables = ensure_hash(params[:variables]) | |
context = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const links = await dub.links.list({ | |
tenantId: "xxx" | |
}).then((res) => res.result) | |
// if you need all time stats, the links array should have `clicks`, `leads` and `sales` | |
// for a certain timeframe | |
const analytics = await Promise.all(links.map(async (link) => { | |
return await dub.analytics.retrieve({ | |
event: "composite", // to get clicks, leads, sales, and saleAmount |
OlderNewer