Skip to main content

sendPageView()

The asynchronous sendPageView method sends the Beyable object to the server.
It contains the information of the page we are on and must be inserted on each page where you want your campange to display.

If in the backoffice you have defined campaigns for this specific page, they will then be retrieved with this method and then inserted in the DOM.

If you have defined specific triggers, then the campaign is display only if the collected user data has validated the activation conditions.

To do that import the beyable export object from the authentification like this:

import { EPageUrlType } from "@beyable/sdk";
import { beyable } from "./config/beyable";
const beyablePageView = async () => {
beyable.page.setAttributes({
urlType: EPageUrlType.HOME,
homePage: {
tags: ["homepage", "corporate"],
},
pageReferrer: document.referrer,
url: "http://localhost",
});
await beyable.sendPageview();
};

In the next section we will speak about the setAttributes method which is allow you to linked your campaign to specifics page.