Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken internal links priority #528

Merged
merged 11 commits into from
Dec 17, 2024
Merged

Broken internal links priority #528

merged 11 commits into from
Dec 17, 2024

Conversation

nitinja
Copy link
Member

@nitinja nitinja commented Dec 13, 2024

Related Issues

https://jira.corp.adobe.com/browse/SITES-27242

Linked PR: adobe/spacecat-shared#491

Test cases coming soon.

✅ Data accuracy: I have validated the results. The new results match old/existing results. Hence this implementation is accurate.

This PR changes RUM event from 404 to 404 and navigate. It also removes associated logic to filter links from same sources since it's now done from the RUM client itself.

It also adds logic to calculate priorities based on page views for each link in following way (as discussed in Figma prototype).
Priority: High: top 25%, Medium: next 25%, Low: bottom 50%

**Note: I believe this logic can be improved for much more correctness. I will be discussing with team about this logic and will come up with more optimized logic. **

Sample data input

[
  {
    "id": "56ou",
    "host": "rum.hlx.page",
    "time": "2024-11-23T23:00:01.858Z",
    "timeSlot": "2024-11-23T23:00:00.000Z",
    "url": "https://www.petplace.com/a01",
    "userAgent": "mobile:android:blink",
    "weight": 200,
    "events": [
      {
        "checkpoint": "navigate",
        "target": "visible",
        "source": "https://www.petplace.com/a01nf",
        "timeDelta": 1858
      },
      {
        "checkpoint": "navigate",
        "target": "visible",
        "source": "https://www.petplace.com/a01nf",
        "timeDelta": 1654
      },
      {
        "checkpoint": "404",
        "target": "",
        "source": "https://www.petplace.com/a01nf",
        "timeDelta": 218
      }
    ]
  },
  {
    "id": "2no",
    "host": "rum.hlx.page",
    "time": "2024-11-22T18:00:00.544Z",
    "timeSlot": "2024-11-22T18:00:00.000Z",
    "url": "https://www.petplace.com/a01",
    "userAgent": "desktop:windows:blink",
    "weight": 1800,
    "events": [
      {
        "checkpoint": "navigate",
        "target": "visible",
        "source": "https://www.petplace.com/a02nf",
        "timeDelta": 542
      },
      {
        "checkpoint": "404",
        "target": "xxxx",
        "source": "https://www.petplace.com/a02nf",
        "timeDelta": 45
      }
    ]
  },
  {
    "id": "4FGLNSev",
    "host": "rum.hlx.page",
    "time": "2024-11-23T23:00:33.919Z",
    "timeSlot": "2024-11-23T23:00:00.000Z",
    "url": "https://www.petplace.com/a01",
    "userAgent": "desktop:mac:blink",
    "weight": 100,
    "events": [
      {
        "checkpoint": "navigate",
        "target": "hidden",
        "source": "https://www.petplace.com/a03",
        "timeDelta": -3599620
      }
    ]
  },
  {
    "id": "Hdq",
    "host": "rum.hlx.page",
    "time": "2024-11-24T00:00:00.111Z",
    "timeSlot": "2024-11-24T00:00:00.000Z",
    "url": "https://www.petplace.com/a01",
    "userAgent": "mobile:android:blink",
    "weight": 100,
    "events": []
  },
  {
    "id": "9DTknv",
    "host": "rum.hlx.page",
    "time": "2024-11-24T00:00:14.264Z",
    "timeSlot": "2024-11-24T00:00:00.000Z",
    "url": "https://www.petplace.com/a01",
    "userAgent": "mobile:android:blink",
    "weight": 100,
    "events": []
  },
  {
    "id": "9LOQXfu",
    "host": "rum.hlx.page",
    "time": "2024-11-22T23:00:00.581Z",
    "timeSlot": "2024-11-22T23:00:00.000Z",
    "url": "https://www.petplace.com/a01",
    "userAgent": "mobile:ios:webkit",
    "weight": 100,
    "events": [
      {
        "checkpoint": "404",
        "target": "https://www.petplace.com/a04nf",
        "source": "",
        "timeDelta": 198
      }
    ]
  },
  {
    "id": "047B",
    "host": "rum.hlx.page",
    "time": "2024-11-20T20:00:01.683Z",
    "timeSlot": "2024-11-20T20:00:00.000Z",
    "url": "https://www.petplace.com/ax02",
    "userAgent": "desktop:windows",
    "weight": 700,
    "events": [
      {
        "checkpoint": "404",
        "target": "ddd",
        "source": "https://www.petplace.com/ax02nf",
        "timeDelta": 259
      },
      {
        "checkpoint": "navigate",
        "target": "hidden",
        "source": "https://www.petplace.com/ax02nf",
        "timeDelta": 1680
      }
    ]
  },
  {
    "id": "048C",
    "host": "rum.hlx.page",
    "time": "2024-11-20T20:00:01.683Z",
    "timeSlot": "2024-11-20T20:00:00.000Z",
    "url": "https://www.petplace.com/ax02",
    "userAgent": "desktop:windows",
    "weight": 500,
    "events": [
      {
        "checkpoint": "404",
        "target": "ddd",
        "source": "https://www.petplace.com/ax02nf",
        "timeDelta": 259
      },
      {
        "checkpoint": "navigate",
        "target": "hidden",
        "source": "https://www.petplace.com/ax02nf",
        "timeDelta": 1680
      }
    ]
  }
]

Sample output

[
      {
        "traffic_domain": 1800,
        "url_to": "https://www.petplace.com/a01",
        "url_from": "https://www.petplace.com/a02nf",
        "priority": "high"
      },
      {
        "traffic_domain": 1200,
        "url_to": "https://www.petplace.com/ax02",
        "url_from": "https://www.petplace.com/ax02nf",
        "priority": "medium"
      },
      {
        "traffic_domain": 200,
        "url_to": "https://www.petplace.com/a01",
        "url_from": "https://www.petplace.com/a01nf",
        "priority": "low"
      }
    ]

Copy link

This PR will trigger no release when merged.

@@ -26,11 +26,13 @@ const AUDIT_RESULT_DATA = [
url_to: 'https://www.example.com/article/dogs/breeds/choosing-an-irish-setter',
url_from: 'https://www.example.com/article/dogs/just-for-fun/dogs-good-for-men-13-manly-masculine-dog-breeds',
traffic_domain: 100,
priority: 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the implementation, priority is set to either high, medium, or low; but why it does end up as an integer here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a mistake - leftover code from initial implementation of priorities. I will take care of this while implementing test cases which is not done yet. thx

@nitinja nitinja marked this pull request as ready for review December 17, 2024 14:07
@nitinja nitinja merged commit 14afd79 into main Dec 17, 2024
4 checks passed
@nitinja nitinja deleted the broken-internal-links-priority branch December 17, 2024 14:08
@solaris007
Copy link
Member

🎉 This PR is included in version 1.45.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants