Is it possible to prevent stripping of query params from shared URLs?

跟風遠走 提交于 2019-12-07 17:25:04

问题


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

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

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?


回答1:


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.

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



来源:https://stackoverflow.com/questions/29305683/is-it-possible-to-prevent-stripping-of-query-params-from-shared-urls

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!