dmind-gmbh / extension-cookieman

A GDPR tracking consent popup for the content management system TYPO3. It asks for approval to include tracking objects (cookies, images or any HTML) and includes the objects when consented.
https://extensions.typo3.org/extension/cookieman
GNU General Public License v2.0
34 stars 17 forks source link

Is there a way to link local/extension script-files via inject()? #333

Closed Moongazer closed 5 months ago

Moongazer commented 5 months ago

Feature Request

Not sure if this is possible already, that's why I open it as feature-request here (at least it seems not documented): It would be really great if there is a way to link local/extension script-files in TypoScript inject() object. For example, not all script are always remote on servers at Google, Facebook, etc... Or even if they are, sometimes it is useful to create a wrapper around such tracking-scripts e.g. to mock function calls to fbc().

So if these scripts are stored in a local extension, how can we link them to be loaded dynamically? Hardcoding the following path might work until v11, but I think starting from v12 where the assets directory are generated dynamically by hash-folder names, this will not work anymore. If possible the common TYPO3 approach like EXT:my_ext/Resources/Public/Js/custom.js would be better to create an absolute URL:

plugin.tx_cookieman {
  settings {
    trackingObjects {
      MyCustomSolution {
        inject (
<script src="/typo3conf/ext/my_ext/Resources/Public/Js/custom.js"></script>
        )
      }
    }
  }
}

Any ideas on that matter? Appreciate your feedback 🙂

jonaseberle commented 5 months ago

That was our primary headache for v12 compatibility ;)

See the PR https://github.com/dmind-gmbh/extension-cookieman/pull/323 and the changes of that PR in the documentation for how we approached it.

Basically inject will be a cObject.

But we don't plan to backport that to v11.