I setup my website to use google+signin.
For the login google provides a more or less nice, translated button to log in.
The code
<span id="signinButton">
<span
class="g-signin"
data-callback="signinCallback"
data-clientid="CLIENT_ID"
data-cookiepolicy="single_host_origin"
data-requestvisibleactions="http://schemas.google.com/AddActivity"
data-scope="https://www.googleapis.com/auth/plus.login">
</span>
</span>
is expandet to :
To follow googles developer policies, the app must provide a way to delete the association between your app and the account. (From: google account logout and redirect)
The implemenatation is easy, but as far as I understood does Google not provide a (styled/desigend) disconnect button. Or did I miss it?
It should look similar/like the login button.
To follow the policies, you have to provide a way for your user's to revoke your app's access to their information and account. This is different than logging out.
See how to provide that disconnection and revoking of access
After the user disconnects, then you would perform the clean up steps required by the terms.
Here is an example that uses jQuery from the documentation. It assumes that you stored your access token in the global variable access_token:
<script type="text/javascript">
function disconnectUser(access_token) {
var revokeUrl = 'https://accounts.google.com/o/oauth2/revoke?token=' +
access_token;
// Perform an asynchronous GET request.
$.ajax({
type: 'GET',
url: revokeUrl,
async: false,
contentType: "application/json",
dataType: 'jsonp',
success: function(nullResponse) {
// Do something now that user is disconnected
// Start account clean up
},
error: function(e) {
// Handle the error
// console.log(e);
// You could point users to manually disconnect if unsuccessful
// https://plus.google.com/apps
}
});
}
// Could trigger the disconnect on a button click
$('#revokeButton').click(disconnectUser);
</script>
<button id="revokeButton">Disconnect</button>
Edit:
If you'd like resources to assist with customizing the look of a disconnect button to match up with the look of the sign-in button, you can use the resources that are provided on the Google+ Platform branding guidelines page. On that page, you can download PhotoShop source files that you can use to create a disconnect button for your site. You will need to follow the instructions on that page to comply with the branding guidelines.
How sites choose to offer a disconnect option is up to the designer. One site might prefer a disconnect link and another to use a button, the design is up to you.
FYI even though their rules do say you must provide a way for a user to revoke access, it doesn't force you to make it easy for the user to do so. Most sites tend to tuck away the ability to disconnect in a user settings menu somewhere, keeping it as a text link. You really don't want users to disconnect and leave forever that easily.
If you're still bent on having the button though, have a look here for a CSS solution
https://developers.google.com/+/web/signin/#customizing_the_sign-in_button
Customize as necessary. Good luck!
Related
I am building a console and have successfully rendered my iframe:
gapi.load('gapi.iframes', function() {
var options = {
'url': 'https://play.google.com/work/embedded/search?token=' + data + '&mode=SELECT',
'where': document.getElementById('container'),
'attributes': { style: 'width: 950px; height:500px', scrolling: 'yes'}
}
However, when I select an app using the provided SELECT button, it only returns the expected payload. I assumed that the iframe would do the heavy lifting here but now know that I need to build the logic. Can someone point me in the rightt direction here for approving the app via SELECT button? Is there a set of iframe events that I should be writing this with in mind? I'm completely lost since documentation here https://developers.google.com/android/management/apps#select-button_1
is extremely vague. Has anyone had issues with this before?
Thanks!
The documentation for the select button indicates that “You need to specify the action that takes place when the IT admin clicks this button”. It is up to the EMM to decide what to do next. You could prompt the user to approve the app on play.google.com/work
For example, you need to approve dropbox. You need to login with your enterprise account then go to this link https://play.google.com/work/apps/details?id=com.dropbox.android and then approve the app.
Or you could prompt the user to add the application to a policy, which automatically approves the app for use by the user’s enterprise.
You may refer to this link for more information about handling iframe events.
Is there a way to pass GA cookies for cross domain tracking when user uses right click (instead of a left click) to hop domains?
It would seem that reliance is on autoLink, which decorates links automatically on left click and does not directly provide for alternative events.
Since I'm working on assumptions I'm not providing complete solutions.
Per autoLink in GA's analytics.js devguide:
// Loads the Linker plugin
ga('require', 'linker');
// Instructs the Linker plugin to automatically add linker parameters
// to all links and forms pointing to the domain "destination.com".
ga('linker:autoLink', ['destination.com'], false, true);
This will also operate on oncontextmenu so if the visitor right-clicks and selects "Open in new tab", the link is still decorated and will have the data appended.
Where decoration is required on other events, autoLinking needs to be extended by manually adding linker parameters using:
ga('linker:decorate', destinationLink);
Such a function call decorates a link based on the domains listed in the 'linker:autoLink` array above. It can be adapted to apply to all cross-domain links.
Assuming the context menu needs to be disabled:
From Andy E's answer
destinationLink.oncontextmenu = function ()
{
ga('linker:decorate', destinationLink);
console.log(destinationLink.href);
document.location = destinationLink.href;
return false;
}
That will decorate the link on right click and direct the browser to the decorated URL.
If the context menu is already disabled, abbreviating Andy E's code:
destinationLink.addEventListener('mousedown', function (e) {
console.log('mousedown', e);
if (3 == e.which) { // is it a right click
ga('linker:decorate', destinationLink)
document.location = destinationLink.href;
}
})
Note that decoration must occur as soon as possible before the visitor clicks since the parameters expire after 2 minutes.
Analytics Ninja, adapt your code to your specific requirements and if you run into further issues, please follow Philip Walton's advice
If I want to use Google analytics and at the same time make my site SEO friendly in React, what is the best way?
At the moment I use react-router and a flux pattern where I change the route and then in componentDidMount I fire an action that loads my data through ajax and then updates the store which emits the change and finally I re-render the components that are affected. During the ajax loading I dispatch an event so that my store knows ajax is loading and render a spinner in my component.
I have noticed that when I send my tracking data to Google the ajax has not finished loading and I only send the new page URL not the title or any other data which I load through ajax (I guess this is bad from an SEO perspective and it's definitely bad for my GA data).
This is my GA setup (I use react-ga):
Router.run(routes, Router.HistoryLocation, function(Handler, state) {
ga.pageview(state.pathname);
React.render(<Handler />, document.body);
});
Typical component setup (which allows me to render the correct data based on the URL):
componentDidMount: function() {
ItemStore.addChangeListener(this._onChange);
if(itemSlug) {
ItemActions.loadItemBySlug(this.props.slug);
}
}
I want to be able to have a single point of GA tracking if that is possible. I also want the SEO handling to be correct for the page:
Page title
OG data
H1
etc ...
What is the best approach to solve this?
Should I use the willTransitionTo option in react-router for this? (is it possible to use a loading spinner if I opt for this solution?)
statics: {
willTransitionTo: function (transition, params, query, callback) {
// LOAD AJAX HERE ?
callback();
}
}
How would I go about the willTransistionTo solution in a proper way, can't seem to find any good examples that relate?
Should I add more code, or is it clear what I'm trying to achieve?
Trigger the ga.pageview after the store gets the new data and renders.
The appropriate way to handle SEO in react is to render at the server side isomorphically with React.renderToString, so that any search engine will see the page in its complete state, rather than just Google's spider and only on those occasions when you manually call it.
This was one of the original design criteria of React.
Having integrated PayPal Express for one of our clients (in ASPX WebForms) and received some under-documented integration steps (https://developer.paypal.com/docs/classic/express-checkout/in-context/integration/) for bolting on the so-called in-context integration, we're facing the following issues:
1) The document asks for the Merchant ID, which, for a sandbox can't be found, wondering if it's the same as the Username in the API credentials
2) I've set up an aspx page for the express checkout to do the posts and gets, which only requires the order id (this would be /checkout_paypal_nvp.aspx?oid={OrderID} below). Judging by the example code PP provided, we're guessing this is what needs to be passed in, but on clicking the 'Check out with PayPal' button, there's only an about:blank popup appearing, and the page doesn't get executed.
Also wondering if 2) is caused by using the wrong Merchant ID in 1), hence the double question (sorry).
Screenshot for ease of visualisation:
Relevant code:
<a id="lnkPaypalCheckout" href="/checkout_paypal_nvp.aspx?oid=81774"></a>
<script>
window.paypalCheckoutReady = function () {
paypal.checkout.setup('{API_username_here}', {
container: 'lnkPaypalCheckout',
locale: 'en_GB',
environment: 'sandbox'
});
};
</script>
<script src="//www.paypalobjects.com/api/checkout.js" async></script>
Many thanks in advance.
Answers to your issues:
The merchant ID (you can found under My Account > Profile > My business info > Merchant account ID) can be used for both production and sandbox environments.
Please make sure "/checkout_paypal_nvp.aspx?oid=81774” returns with the correct PayPal flow url. If you comment out the two script sections which for in-context setup, you should see the PayPal flow being loaded in the full page. That will be your first step before adding in-context setup.
I have an application on facebook and i have the facebook comment box on it. If someone makes a comment using the comment box, is there a way to notify person that a post has been made on their app
I have the following code
<script src="https://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<fb:comments xid="test" canpost="true" candelete="false" href="<%= link %>" num_posts="10" width="500" send_notification_uid="<%= fbUserId %>" notify="true" publish_feed="true"></fb:comments>
The href - link is a dynamic link depending on where the post was made. The send_notification_uid - user_Id is also dynamic and it retrieves the user id of the person that owns the page.
Any help would be great. It all works apart from the send notification
I believe using the javascript SDK you can subscribe to the comment.create event. Then provided you have the necessary permissions for the uid in question, you could then send them a notification I believe. I haven't tested this but you need to look at the FB.event.subscribe code
https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/
There's some more information on a post here
http://facebook.stackoverflow.com/questions/6146925/fb-event-subscribecomment-create-doesnt-work
Further to this you can test things out on the js skd tool
https://developers.facebook.com/tools/console/
and some sample code
<h1>Defaults</h1>
<fb:comments href="http://www.fbrell.com/"></fb:comments>
<script>
FB.Event.subscribe('comments.add', function(resp) {
console.log('Comment was added' + resp);
});
</script>
I don't know if the specs changed, but the current answer doesn't work anymore, the new way is now this :
FB.Event.subscribe('comment.create', function() {
console.log('Comment was added');
console.log(arguments);
});
comment.create , as explained here : https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/v2.0#comments-example