How to make a custom LinkedIn share button - api

I need to be able to add sharing functionality to my custom button. I'm not interested with their generator, as I can't change LinkedIn image there. I want to use my own image for the LinkedIn share button.

Official LinkedIn API for sharing:
https://developer.linkedin.com/docs/share-on-linkedin
Read Terms of Use!
Example link using "Customized URL" method: http://www.linkedin.com/shareArticle?mini=true&url=https://stackoverflow.com/questions/10713542/how-to-make-custom-linkedin-share-button/10737122&title=How%20to%20make%20custom%20linkedin%20share%20button&summary=some%20summary%20if%20you%20want&source=stackoverflow.com
You just need to open it in popup using JavaScript or load it to iframe. Simple and works - that's what I was looking for!
EDIT: Video attached to a post:
I checked that you can't really embed any video to LinkedIn post, the only option is to add the link to the page with video itself.
You can achieve it by putting YT link into url param:
https://www.linkedin.com/shareArticle?mini=true&url=https://www.youtube.com/watch?v=SBi92AOSW2E
If you specify summary and title then LinkedIn will stop pulling it from the video, e.g.:
https://www.linkedin.com/shareArticle?mini=true&summary=youtube&title=f1&url=https://www.youtube.com/watch?v=SBi92AOSW2E
It does work exactly the same with Vimeo, and probably will work for any website. Hope it will help.
EDIT 2: Pulling images to the post:
When you open above links you will see that LinkedIn loads some images along with the passed URL (and optionally title and summary).
LinkedIn does it automatically, and you can read about it here: https://developer.linkedin.com/docs/share-on-linkedin#opengraph
It's interesting though as it says:
If Open Graph tags are present, LinkedIn's crawler will not have to
rely on it's own analysis to determine what content will be shared,
which improves the likelihood that the information that is shared is
exactly what you intended.
It tells me that even if Open Graph information is not attached, LinkedIn can pull this data based on its own analysis. And in case of YouTube it seems to be the case, as I couldn't find any Open Graph tags added to YouTube pages.

You can make your own sharing button using the LinkedIn ShareArticle URL, which can have the following parameters:
https://www.linkedin.com/shareArticle?mini=true&url={articleUrl}&title={articleTitle}&summary={articleSummary}&source={articleSource}
You can find the documentation here, just choose "Customized URL" to see the details.

Step 1 - Getting the URL Right
Many of the answers here were valid until recently. For now, the ONLY supported param is url, and the new share link is as follows...
https://www.linkedin.com/sharing/share-offsite/?url={url}
Make sure url is encoded, using something like fixedEncodeURIComponent().
Source: Official Microsoft.com Linkedin Share Plugin Documentation. All LinkedIn.com links for developer documentation appear to be blank pages now -- perhaps related to the acquisition of LinkedIn by Microsoft.
Step 2 - Setting Custom Parameters (Title, Image, Summary, etc.)
Once upon a time, you could use these params: title, summary, source. But if you look closely at all of the documentation, there is actually still a way to still set summary, title, etc.! Put these in the <head> block of the page you want to share...
<meta property='og:title' content='Title of the article"/>
<meta property='og:image' content='//media.example.com/ 1234567.jpg"/>
<meta property='og:description' content='Description that will show in the preview"/>
<meta property='og:url' content='//www.example.com/URL of the article" />
Then LinkedIn will use these! Source: LinkedIn Developer Docs: Making Your Website Shareable on LinkedIn.
Step 3 - Verifying LinkedIn Share Results
Not sure you did everything right? Take the URL of the page you are sharing (i.e., example.com, not linkedin.com/share?url=example.com), and input that URL into the following: LinkedIn Post Inspector. This will tell you everything about how your URL is being shared!
This also pulls/invalidates the current cache of your page, and then refreshes it (in case you have a stuck, cached version of your page in LinkedIn's database). Because it pulls the cache, then refreshes it, sometimes it's best to use the LinkedIn Post Inspector twice, and use the second result as the expected output.
Still not sure? Here's an online demo I built with 20+ social share services. Inspect the source code and find out for yourself how exactly the LinkedIn sharing is working.
Step 4 - Finding More Social Sharing Services and Their Share URLs
I have been maintaining a Github Repo that's been tracking social-share URL formats since 2012, check it out: Github: Social Share URLs.
Why not join in on all the social share url's?

Its best to use customize url approach. And its the easiest. Found this one. It will open a popup window and you dont need any bs authentication issues because of w_share and all.
<a href="https://www.linkedin.com/shareArticle?mini=true&url=http://chillyfacts.com/create-linkedin-share-button-on-website-webpages&title=Create LinkedIn Share button on Website Webpages&summary=chillyfacts.com&source=Chillyfacts" onclick="window.open(this.href, 'mywin', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;">
<img src="http://chillyfacts.com/wp-content/uploads/2017/06/LinkedIN.gif" alt="" width="54" height="20" />
</a>
Just change the url with your own url. Here is the link http://chillyfacts.com/create-linkedin-share-button-on-website-webpages/

The API is updated now and the previous API will be deprecated on 1st March, 2019.
To create a custom Share button for LinkedIn, you need to make POST calls now. You can read the updated documentation here for doing so.

LinkedIn revised their site recently, so there are a ton of old links just redirecting to the developer support homepage. Here is an updated link to the relevant page on LinkedIn's support site (as of Feb 16, 2015): https://developer.linkedin.com/docs/share-on-linkedin

LinkedIn has updated their api and the sharing url's no longer works. Now you can only use the url query parameter. Any other parameter is going to be removed from the url by LinkedIn.
Now you're forced to use oAuth and interact with the linkedin API to share content on behalf of a user.

This works for me:
https://www.linkedin.com/shareArticle?mini=true&url=articleUrl&title=YourarticleTitle&summary=YourarticleSummary&source=YourarticleSource
You can use this link by replacing it with your content. It works 100%.

You can customize the standard Linkedin button like this, after the page load:
$(".IN-widget span:first-of-type").css({
'border': '2px solid #DCDCDC',
'-webkit-border-radius': '3px',
'-moz-border-radius': '3px',
'border-radius': '3px'
});

Related

Rally : document.referrer is not returning complete URL

We have created a custom App using Rally SDK. We are providing link to this app in a custom field in USER story. Once we click on this link, it gets redirected to the App. Within this app, we want know from which User story it has redirected from.
For the same purpose we are making use of document.referrer. However, it only returns 'https://rally1.rallydev.com' and not the complete URL.
Based on our research, we come to know that meta tag for refferer with appropriate value has to be mentioned in the web page to get the complete URL. Which we think is not mentioned in this case.
Please correct if our understanding is wrong.
It will be very helpful if you could suggest any alternatives to achieve this.

is possible to do SEO for API Content?

One of my client having website which is entirely based on API Content i.e. content coming from 3rd party website. He wants to do some seo on the data. I wonder if it is possible as there is data not available in his database and i think google crawler redirect to 3rd party website while crawling on such pages. We already asked for permission from that website owner to let us store API data on our end in order to do some SEO but he refused our request.
It will be highly appericited if you can suggest any other way that should not be against policies and guidelines.
Thank You
Vikas S.
Yes - with a huge BUT:
Google explains how parameters can be set within their Search Console (Google Webmaster) and how these can effect the crawler's behaviour.
#Nadeem Haddadeen is right with the canonical links between duplicates. There's also an issue if you don't have consistent content when calling up the same parameters. This essentially makes your page un-indexable as it's dynamic content. If you are dealing with dynamic content then you need to optimise a host page based around popular queries rather than trying to have your content rate itself.
It's not recommended to take the same content and post it on your website, its duplicate and Google will give you penalty.
If you still want to post it on your website, you have to make some changes on the original text and then post it on your website to look like its original.
Also if you want to keep it without any changes and to avoid any penalties from Google, you you have to add a link for the original article from your website or add a cross domain canonical link like the below example:
<link rel="canonical" href="https://example.com/original-article-url" />

What is my google-signin-client_id

My web site used to have a link to let users login with their Google accounts in Open ID 2.0. Since 20.4.2015, this is no longer working, so I am trying to migrate to Google Sign-In.
This page:
https://developers.google.com/identity/sign-in/web/sign-in#specify_your_apps_client_id
says:
Specify the client ID you created for your app in the Google Developers Console with the google-signin-client_id meta element.
I have no idea what my client ID is. In my Google Developers Console:
https://console.developers.google.com/project
there is only a single, very old application I created with GoogleApp, which is not related at all to the website I am talking about. I tried using its project ID anyway, and got the following error after clicking the sign-in button:
401. That’s an error.
Error: invalid_client
The OAuth client was not found.
Request Details
fetch_basic_profile=true
scope=email profile openid
response_type=permission
redirect_uri=storagerelay://http/localhost?id=auth684995
ss_domain=http://localhost
client_id=imitatorgwt.apps.googleusercontent.com
openid.realm=
That’s all we know.
What exactly should I write in the google-signin-client_id meta tag?
You need to create/configure a Google OAuth client. For detailed instructions on how to do so for Google OpenID2 -> OpenID Connect migration, check out Google's migration dev docs (in particular the pieces related to Google Developers Console).
A possible work-flow is:
Go to Google Developer Console.
Under "Select a project" on the top, select "Create new project" and fill the details.
In the dashboard on the left, go to "API & Auth" -> Credentials.
Under "OAuth", click "Create new client ID".
Under "Application type", select "Web application".
Under "Authorized Javascript origins", enter the URL(s) of your website. The "Authorized redirect URLs" are updated automatically.
Click "Create client ID".
The new client ID can be accessed any time by going to "Credentials" in the left dashboard. It looks something like this: "3453453452345-dfgjw3456u2094mlfg45p.apps.googleusercontent.com".
Hope that helps!
UPDATE
We have updated the referred documentation with instructions on how to create Google projects+client ids, see https://developers.google.com/identity/sign-in/web/devconsole-project. That should make things easier for developers in the future.
Again, thanks for reporting the problem!
Having implemented "Google Sign-in for Websites" in a couple of projects, at first the Google guideline confused me a bit at the following line:
<head>
<meta name="google-signin-client_id" content="YOUR_CLIENT_ID.apps.googleusercontent.com">
</head>
The line <meta name="google-signin-client_id"... at first got me thinking that i needed to place some google-id here.
Now to answer the question:
What exactly should I write in the google-signin-client_id meta tag?
<meta> is part of HTML standard, and this tag provides metadata (or information) about the HTML Document. Metadata will not be displayed on the page, but will be machine parsable. source: w3schools html reference.
Therefore just remember that the "name" attribute of the tag just literally specifies a name for the metadata. In other words, it just describes the "content" attribute. Try changing name="google-signin-client_id" to say name="my-content" and see what happens.
Always remember: the best way to learn is try, fail, debug and correct.

How can I change the base url shown in the store?

I'm using WSO2 API Manager.
In an API, in User Overview tab below url is shown as Production and Sandbox URLs which are correct
http://myapistore.com:8280/railway/2.0
But in the same api under API console tab below url is shown as base url which is incorrect
http://myapistore.com/store:8280
But actually the base url should be http://myapistore.com:8280
So altogether API url would be
http://myapistore.com:8280/railway/2.0/station/getAll
How can I change the base url?
In my WSO2 API Store my services are shown correctly. When I click on the tab sheet, the URLS are shown correctly even when I hover over these links.
Did you register the service correctly?
You probably already figured out the answer to your question, but I came here looking for how to change the production URL of an API, and thought I would share the answer to that question here, for any future googlers :)
This is the view we're talking about, the API overview. Notice that the Production Endpoint is wrong (should be worldbank, not worldbanks).
Click on Edit API in the top blue bar, and in the second step you'll be able to change it.
(notice the corrected URL)
I hope this will help someone in the future :)

Get all reviews and ratting from gplus

I have to get list of comment and rating of my goolge-plus page in json format form this url (test url)
https://plus.google.com/b/116355901745826833455/116355901745826833455/posts
I try in developer section of google-plus page. but i dont get appropriate method to find this. please any body can told me in which section of google developer i found this method. this is the first time i have to integrate any google api.
For your Google+ Page, you can make a call to activities.list using the Google+ Page ID to see all of the public posts that the Page has made, including +1s and comments and reshares on those posts. The documentation explains it well and also has an API explorer which you can try for yourself.
For additional information on a particular post, you can try comments.list--as you mentioned--or activities.get.
For the number of +1s for the Google+ Page specifically, you can try a people.get call using the Page ID.
The Google+ API does provide you with some information you ask for as Joanna states, but I believe what you really are looking for is the Place details within the Google Places API, which provides details about businesses, such as reviews. That API will return ratings and reviews. If you also needed +1s then you'd need to use both APIs.