Type Alias: ConnectIntegration()
ConnectIntegration = (
integration
,context
) => () =>void
|undefined
Describes the contract that an external API tracking script must implement so that it can be imported and executed by the integration. The API script must be hosted on the remote server with CORS enabled.
Parameters
integration
context
integrationEnvironment?
string
userCountryCode?
string
userId?
string
Returns
() => void
| undefined
Examples
import { IntegrationEvent } from '@glomex/integration';
export const connectIntegration: ConnectIntegration = (
integration,
// userId will be undefined when no consent is given
{ userCountryCode, userId, integrationEnvironment }
) => {
integration.addEventListener(IntegrationEvent.CONTENT_PLAY, () => {
console.log('play', integration.content);
});
};
export const connectIntegration = (
integration,
// userId will be undefined when no consent is given
{ userCountryCode, userId, integrationEnvironment }
) => {
const { IntegrationEvent } = integration.constructor;
integration.addEventListener(IntegrationEvent.CONTENT_PLAY, () => {
console.log('play', integration.content);
});
};
Last updated on