是否可以防止从共享URL中剥离查询参数

是否可以防止从共享URL中剥离查询参数

本文介绍了是否可以防止从共享URL中剥离查询参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们利用LinkedIn的自定义URL"允许将文章共享给LinkedIn用户的供稿. ( https://developer.linkedin.com/docs/share-on-linkedin)传递到"url"参数中的编码URL包含我们自己的跟踪参数.

We utilize the LinkedIn "Customized URL" to allow sharing of articles to LinkedIn users' feeds. (https://developer.linkedin.com/docs/share-on-linkedin) The encoded URL that is passed into the "url" parameter contains our own tracking parameters.

https://www.linkedin.com/shareArticle?url=http%3A%2F%2Fwww.thedailybeast.com%2Farticles%2F2015%2F03%2F26%2Famerica-loses-no-matter-who-wins-the-next-great-middle-east-war.html%3Fvia%3Ddesktop%26social%3DLinkedin

不幸的是,以这种方式共享的文章的URL已删除了查询参数.

Unfortunately, the URL's to our articles shared in this way have been stripped of the query parameters.

推测的原因是,LinkedIn提取了我们的og:url元数据,并将该规范URL用于共享的链接.我们希望重写此方法,但是文档似乎表明只有在使用REST API的情况下才有可能.我们宁愿避免这种情况,因为我们仅尝试将文章共享给LinkedIn.有人可以告诉我是否还有其他方法可以使用"shareArticle" URL来整合我们的跟踪查询参数?

The presumed reason is that LinkedIn ingests our og:url metadata and uses that canonical URL for the link that is shared. We'd prefer to override this, but the docs seem to indicate that that is only possible if you use the REST API. We'd prefer to avoid that since we are only trying to share articles to LinkedIn. Can someone tell me if there is any other way to incorporate our tracking query params using the "shareArticle" URL?

推荐答案

如果您使用API​​进行共享,而不是像通过URL那样通过URL进行共享,则可以专门提供LinkedIn将使用的值,从而避免抓取工具被窃取页面的元数据并覆盖"您为其提供的URL.

If you utilize the API for sharing, rather than via URL as you are doing, you can specifically provide values that LinkedIn will use, which avoids the crawler picking up the page's meta-data and "overriding" the URL you are giving it.

有关在此处进行API调用的更多信息: https://developer.linkedin.com /docs/share-on-linkedin

More information on making the API call here: https://developer.linkedin.com/docs/share-on-linkedin

这篇关于是否可以防止从共享URL中剥离查询参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 00:06