Track media items hardcoded into the BODY field?

Created on 6 August 2024, 7 months ago

Problem/Motivation

I migrated a bunch of content from a non-drupal source and we moved all files and placed in site/oursite/files/{file_name]
It seems if I use the CKeditor media embed for example the usage does gets tracked.
Files hardcoded such as "<a href="/sites/ed/files/2024-08/test.pdf">test.pdf</a> do not get tracked.

Am i missing a config issue or without the data-uuid portion am I barking up the wrong module maintainers tree?

Thanks so much!

πŸ’¬ Support request
Status

Active

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Prodigy Atlanta, Georgia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Prodigy
  • πŸ‡ΊπŸ‡ΈUnited States drupal-baby

    I am also having the same issue, were you able to find any information on this?

  • πŸ‡ΊπŸ‡ΈUnited States vetchneons

    Same issue here. I am looking into information on it.

  • πŸ‡ͺπŸ‡ΈSpain marcoscano Barcelona, Spain

    and we moved all files and placed in site/oursite/files/{file_name]

    Are the files managed in Drupal or these are just links pointing to files in disk that happen to be at these locations? If the files are not file entities in Drupal (ie in the file_managed table), then this module won't track them, by design.

  • πŸ‡ΊπŸ‡ΈUnited States vetchneons

    I actually dug into this today and it turns out, in our environment, that the relative paths were tracking, but the absolute links were not.

    return $this->pathValidator()->getUrlIfValidWithoutAccessCheck($url);

    in the processUrl inside EntityUsageTrackBase.php was always returning false for file that were using absolute links in ckeditor. The same files using relative paths are getting counted correctly.

  • πŸ‡ΊπŸ‡ΈUnited States vetchneons

    Are the files managed in Drupal or these are just links pointing to files in disk that happen to be at these locations? If the files are not file entities in Drupal (ie in the file_managed table), then this module won't track them, by design.

    That makes sense. I can confirm that this was the case for us. sites/default/files/<filepath> was tracking correctly, while sites/files/<filepath> was not.

  • πŸ‡ΊπŸ‡ΈUnited States Prodigy Atlanta, Georgia

    Appreciate the follow up @vetchneons

  • πŸ‡ΊπŸ‡ΈUnited States pbabin

    Asking here but think it is unrelated. We are having this same issue where both hardcoded relative and absolute paths to files are not registered in entity_usage. I can confirm that our file structure is /sites/default/files/media, at least locally where I am doing all of my testing at the moment. I've tried multiple variations of source/target to rule out these; however, anything that is hardcode is missed.

    The one factor, which I believe makes this semi-unrelated, is that I am trying to track entity usage in paragraphs with text editors as we are using the layout_paragraphs module.

    Does this then point us to Track composite (e.g. paragraph) entities directly and only as their host β†’ ? Which suggests we wait till the next major release?

    Thank you in advance!

Production build 0.71.5 2024