Home App Docs Blog Github

Why do I not see tracking / impression / click / pageview data for my Builder content?

If you have live content that has been live for a few days, you know that it has gotten traffic, and you do not see any tracking data, it is most likely due to an integration error. The most common issue is not initializing Builder with the proper API key.

If you are using one of SDKs to integrate Builder into your site, make sure that you call builder.init(apiKey) with your organization’s api key inside of your application’s code (before any other Builder methods are called). This will allow tracking calls made from your content to be associated with your account.

Hello,
I initialize my builder sdk only once when my app starts and then I use it inside application and I don’t see any data. Do I need to initialize the builder before every method call?

You should only need to init Builder once in your code, but it does need to be in a code path that will always be called for each request. Here is an example of where we call builder.init on Builder’s website, which uses Next.js: builder/_app.tsx at main · BuilderIO/builder · GitHub.

As it still doesn’t work for me I want to describe my case deeper.
I use our own framework for server rendering, so I unfortunately could not use examples from next or gatsby snippets.
Before rendering particular page on each request I create service where init the builder and get data from builder, it looks like:

`export class BuilderService {

constructor(envManager) {
const apiKey = envManager.get(ENV.BUILDER_PUBLIC_KEY);
this.init(apiKey);
}

init(apiKey) {
builder.init(apiKey);
}

async getBuilderData(model, props={}) {
const data = await builder.get(model, props).promise();
return data;
}
}`

Then I use this data in my builder component as content:
<BuilderComponent model={builderModel} content={content} data={data} />;

what I do wrong?

Can you share a link to one of the content entries in Builder where you expect to see analytics but do not? The link would be something like builder.io/content/someId