elasticsuite
elasticsuite copied to clipboard
Why is this js still used when tracking is disabled in the backend
Hello
his is more a quastion to understand the module-elasticsuite-tracker. We are currently looking for unnessecary javascipts in the shop to speed up the frontend.
We find out that the script Smile_ElasticsuiteTracker/js/tracking.js is included in every page which is of course fine.
But in our case we have disabled the tracking using store -> Configuration -> ElasticSuite -> Tracking -> Global Configuration

So in my optinon there is no need to include this script, right?
Thanks for your help.
I agree, tracking.js should not be loaded once the module is disabled.
My remedy:
THEME\Smile_ElasticsuiteTracker\layout\default.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<remove src="Smile_ElasticsuiteTracker::js/tracking.js"/>
</head>
<body>
<referenceBlock name="smile.tracker.page.base" remove="true" />
<referenceBlock name="smile.tracker.page.catalog" remove="true" />
<referenceBlock name="smile.tracker.config" remove="true" />
</body>
</page>
@OvalMedia You are right this is the way to remove it. But I want to know if this will break something. Maybe there is a need to inculde the js/tracking.js even when it is disabled in the backend. Maybe someone from smile knows.
I could not find so much information of the modul Smile_ElasticsuiteTracker to figure this out on my own.
This is from a store currently in the works. So far I have not faced any issues removing the tracking stuff.
Hi,
removing the tracking will prevent the Search Analytics Dashboard to work fine, since no data will be collected at all.
That being said, you can disable the tracking safely if you don't care about the Search Analytics. But I'd rather go with a short retention delay parameter for tracking if you're concerned with disk space. Probably 10 or 15 days should be enough to analyze search performance on a weekly basis through the dashboard, and not to take too much space on the Elasticsearch index.
That being said, what's missing by our side is probably something to not include at all the javascript file if tracking is disabled.
Thanks @romainruaud for your answer. We disabled the tacking due to a lot of database write processes. It would be nice if you will remove the javascript when tracing is disabled.
Hello @frostblogNet, @OvalMedia,
Disabling the module, not just in Store > Config, but through module:disable (you will have to disable Smile_ElasticsuiteAnalytics too) will prevent the layout file to be taken into account, and thus, the JS file being loaded.
I'll look if there is a way to have a condition script tag anyway.
Regards,
Hello @rbayet
sure you can do this of cause but disable module is in my opinion not very failsave. Somebody could easily reenable it by accident. Maybe it is possible to do it with a composer replace. I will try it and report back.
Thanks
Ideally the js file would be required through a phtml file which can then be included in the layout with an ifconfig option pointing to whether or not analytics is enabled.
Problem is, I believe the file in question isn't requirejs compatible in its current form.
2 years old issue -> I close.
Feel free to open a new one if needed.
Regards