adjust / smart_banner_sdk

Adjust Smart Banner SDK
MIT License
1 stars 0 forks source link

self is not defined #16

Closed qingbolove closed 2 months ago

qingbolove commented 2 months ago

image When I integrate the sdk using the documents, I encounter an issue that self is not defined, I cannot proceed anymore, please help

YaraMatkova commented 2 months ago

Hi @qingbolove, thank you for reaching out.

Could you please share more details? What framework do you use?

qingbolove commented 2 months ago

this is because we are using nextjs, smart banner sdk do not support nextjs ssr mode, we need to use it this way: AdjustSmartBanner = (await import('@adjustcom/smart-banner-sdk')).default;

YaraMatkova commented 2 months ago

Yes, the SDK should run on browser side only and not on server side.

Probably you should as a workaround import the SDK only when window is defined

 if (typeof window !== 'undefined') {
    AdjustSbSdk = (await import("@adjustcom/adjust-web-sdk")).default;
    // ... 
}

Closing this now, feel free to comment or reopen if there is still some assistance needed.