Builder content gets a tiny image pixel added to it in order for Builder to keep track of pageviews for your content. It must be included on any content that is served from Builder, but sometimes you might need to make changes to the format in order to meet your company’s internal guidelines (such as accessibility). In order to make changes, such as adding a specifc alt
tag, you can use the Builder utils library to modify the content that is fetched from the Builder API.
import { setPixelProperties } from '@builder.io/utils';
export async function getServerSideProps({
params,
}) {
const page =
(await builder
.get(mode, ....)
.toPromise()) || null
setPixelProperties(page, { alt: 'pixel tag from builder' })
return {
props: {
page,
},
}
}
Check out the readme in Github for even more useful utility functions: builder/packages/utils at main · BuilderIO/builder · GitHub