https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
a

average-match-24139

12/07/2023, 3:32 PM
Hi all πŸ‘‹ I have a question related to the
backgroundSync
setting. I added it to the SDK on my WP page (see screenshot) but the API call stills seems to happen every 30 seconds. Has anyone experienced this or knows why it might not be working?
r

rhythmic-agent-34208

12/07/2023, 3:32 PM
⭐ Our official support hours are 6:30am - 5pm Pacific Time, Monday through Friday. You may occasionally hear from us outside of these hours. Your support request has been logged in our system. Our support team will get back to you very soon!
b

billions-xylophone-11752

12/07/2023, 4:05 PM
Hi, Laszlo! Are you using the pre-built script tag to add GrowthBook to your site? From what I can tell that should disable streaming, I'm digging in a bit further.
Laszlo - Is your
trackingCallback
that you've added working as expected?
a

average-match-24139

12/11/2023, 7:31 AM
Hi Michael πŸ‘‹ Yes, I am using the pre-built script, with a custom tracking callback added. See attached! I’ve also attached a screencap of the visual editor debugger, where everything seems to be green βœ…
πŸ‘€ 1
b

billions-xylophone-11752

12/11/2023, 3:08 PM
Hey, Laszlo - I think you just need to update the script so its
backgroundSync: false
rather than
backgroundSync: "false"
I tested on a Shopify store I'm running the same code on and it disabled the eventStream.
a

average-match-24139

12/11/2023, 3:33 PM
@billions-xylophone-11752 If you check the screenshot, I currently have
backgroundSync: false
. Would you suggest adding β€œβ€ (quotation marks) to fix it?
b

billions-xylophone-11752

12/11/2023, 3:36 PM
Oh goodness - I’m sorry. No, it definitely needs to be a Boolean, not a string. Let me see if I can replicate. My test env is disabling the streaming correctly.
a

average-match-24139

12/11/2023, 3:41 PM
I can also redeploy the script to our prod site, if you are available to check it, just had to disable it so it doesn’t use up our API limit every 30 seconds 😁
b

billions-xylophone-11752

12/11/2023, 3:53 PM
I can be available to check it. I just did another test in my env and with the following code, I am able to disable streaming.
Copy code
<script>
      window.growthbook_config = {
        backgroundSync: false
      }
    </script>

    <script async
      data-api-host="<https://cdn.growthbook.io>"
      data-client-key="SDK-CLIENT-KEY-HIDDEN"
      src="<https://cdn.jsdelivr.net/npm/@growthbook/growthbook/dist/bundles/auto.min.js>"
    ></script>
Also, just to confirm, each message in the eventStream doesn't count towards your API limit. The endpoint is opening a streaming connection. So only the first request is an actual API request that counts towards your limit.
πŸ‘ 1
The caveat is the streaming connection only lasts 5 minutes. So if someone is on the site for more than 5 minutes, the SDK will make a new API call every 5 minutes, to keep the connection fresh.
a

average-match-24139

12/11/2023, 4:35 PM
Thanks for clarifying the contribution to the limit. I will deploy the change tomorrow and ping here to see if you could potentially help troubleshoot it on the live site. Thanks for all the help so far 😊
πŸ™Œ 1
b

billions-xylophone-11752

12/12/2023, 2:15 PM
Hey, Laszlo - I just wanted to keep you in the loop - We've heard reports from a few users that the
backgroundSync: false
attribute isn't being respected in a few cases. The team is looking into this right now. As soon as I hear anything, I'll let you know.
thankyou 1
a

average-match-24139

12/12/2023, 2:34 PM
Thank you. Then I will wait for updates before investigating further on my end.
4 Views