Closed vvvhung closed 1 year ago
It's possible that the theme is incorrectly rendering the scripts or they are being blocked and or grouped by optimizer plugins, you should see something like the following on your page source:
<script src='https://YOUR_DOMAIN/wp-content/plugins/wp-sentry/public/wp-sentry-browser.min.js?ver=6.8.0' id='wp-sentry-browser-js'></script>
Do you have any optimization plugins like WP Rocket, W3 cache or others active?
No, I don't have optimization plugins. As I mention, I can find the script on the WP dashboard when I login, but I can not find it on the homepage: https://elsaspeak.com/en/.
I am seeing no scripts or stylesheets loaded from any WordPress plugin or theme in the
section of that page at all, so that is probably the issue that the theme is probably missing some code to render the styles/scripts in the section.@stayallive yeah, it may be the cause. But I wonder what is the auto-mechanism that WP-Sentry rely on to be render to the theme page? Or do I need to add the script file manually?
Sorry if I bother you with my own theme issues.
We use wp_enqueue_script
: https://github.com/stayallive/wp-sentry/blob/ba2cf8f106e0b139e646d2a9be490b54f7c80bbb/src/class-wp-sentry-js-tracker.php#L184-L189.
This is a core part of WordPress that allows plugins and themes to add scripts and styles to the header or footer of a site. See the developer documentation on this: https://developer.wordpress.org/themes/basics/including-css-javascript/.
Depending on if you are building a classic or block theme there are ways for you to render these enqueued scripts and styles.
@stayallive Yeah, thanks. You are correct, my theme does not call wp_head() so wp_enqueue_scripts() was not called. I will close this issue.
After all settings, I can find the Sentry object (via the browser's console) on the WordPress dashboard page. But I can not find Sentry on my homepage. It shows:
ReferenceError: Can't find variable: Sentry
. Is there anything missing that can cause that issue?