Dynamic script not running on cached page
-
I want to run a short script every time we get a new visitor to the site, which saves a cookie with their landing page and their source.
I’ve written this code and it works as expected and I have hooked it to the “send_headers” hook. I chose this hook because I believe it’s the earliest hook where global $post is set, which I need.
However… when we have caching on our Siteground site the script often doesn’t run on the first page load, presumably when the visitor is being served a cached page.
For example, often if a visit starts on the Homepage the script doesn’t run. It then runs later when they visit an uncached page.
This means our code doesn’t work as expected.
I have added our cookie “bnfo_settings” to the “sgo_bypass_cookies” filter but this hasn’t worked.
Can you provide any guidance of how I can make sure this script is always run please? Obviously I don’t want to turn caching off.
Thank you!The page I need help with: [log in to see the link]
- The topic ‘Dynamic script not running on cached page’ is closed to new replies.