I had a thought about CDNs and if they affect page rankings. Lets say hypothetically if I was to create a CDN as a subfolder in my site. This folder would contain a resource that is useful e.g. Javascript library. This resource I would then share with other sites who would include my CDN resource into their pages.
Would this improve my rankings in Google etc. as their analytics will detect the resource link to my own website and then index it or record it somewhere?