Google button doesn't appear - google-plus

Google +1 button don't want to appear.
I follow the method here: https://developers.google.com/+/web/+1button/
a post on my blog for example: http://misapuntesde.com/post.php?id=256
It's like post.php was a blacklisted page (it doesn't), because I copy/paste the same page to post_t.php and it works.
Google does not like me :(

I'm not seeing the +1 button rending on your page sources. Something you are doing in your PHP code is not rendering the JavaScript include or the +1 markup.
Try adding this code to your site before your closing </body> tag:
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
Next, add the following code where you want the +1 button to render:
<div class="g-plusone" data-annotation="inline" data-width="300"></div>

Related

show multiple result for single page Google custom search

I have single page application in which I want to apply Google custom search. What my requirement is when I search something then it will show result from each section of the page. I have created anchor tag links whenever click on them it will redirect me to that section of the page.
What I try till now I applied code which comes from while creating search engine here is my code:
(function() {
var cx = 'xxxxxxxxxxxxxxxx:xxxxxxxxxx'; //my engine id
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
Thanks for the help!

How to display activity feed of my google plus page in my website?

I would like to display the activity feeds of my facebook, twitter, linkedIn, google+ pages in my website. For facebook and twitter, iam getting the feeds by referring their developer website(image attached) . But I dont know how to get the activity feeds from google plus page. Is there any options are available for it ?
There are tools to help you do this with Google+, but there is no pre-made widget that will do this. You need to combine two components of the Google+ API: the activities.list call and an embedded post.
One very simplistic implementation might look something like this:
<html>
<head>
<title>Plus Posts</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<style>
.post {
display: block;
padding-bottom: 10px;
}
</style>
</head>
<body>
<div id="posts"></div>
<script type="text/javascript">
var plusId = 'profile_id_to_view;
var apiKey = 'API key from developer console';
function start(){
gapi.client.setApiKey( apiKey );
gapi.client.load('plus','v1', function(){
console.log('loaded');
gapi.client.plus.activities.list({
userId: plusId,
collection: 'public',
maxResults: 10
}).execute(function(resp){
if( resp && resp.items && resp.items.length > 0 ){
for( var co=0; co<resp.items.length; co++ ){
$('#posts').append('<div class="post"><div id="posts-'+co+'"></div></div>');
var url = resp.items[co].object.url;
gapi.post.render('posts-'+co, {url:url});
}
} else {
console.log('invalid resp', resp);
}
});
});
}
(function(){
var po = document.createElement( 'script' );
po.type = 'text/javascript';
po.async = true;
po.src = 'https://plus.google.com/js/client:plusone.js?onload=start';
var s = document.getElementsByTagName( 'script' )[0];
s.parentNode.insertBefore( po, s );
})();
</script>
</body>
</html>
You need to create a project and get your own API key from http://console.developers.google.com/ and provide this and the ID for the posts you wish to follow.
There is a simple jquery plugin called Google+ Feed Widget.

Open Web Analytics tracking doesn't work

I am a new owa(Open Web Analytics) user, I have installed owa in /owa/apache/htdocs/owa
and create one index.html under /owa/apache/htdocs with blow content
However I won’t be able to see any analytic statistics from owa after I refreshed index.html several times
<html>
<header>
<!– Start Open Web Analytics Tracker –>
<script type=”text/javascript”>
//<![CDATA[
var owa_baseUrl = 'http://localhost/owa/';
var owa_cmds = owa_cmds || [];
owa_cmds.push(['setSiteId', '4f9312bd29c7edd4d492210b8599a383']);
owa_cmds.push(['trackPageView']);
owa_cmds.push(['trackClicks']);
owa_cmds.push(['trackDomStream']);
(function() {
var _owa = document.createElement(‘script’); _owa.type = ‘text/javascript’; _owa.async = true;
owa_baseUrl = (‘https:’ == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, ‘https:’) : owa_baseUrl );
_owa.src = owa_baseUrl + ‘modules/base/js/owa.tracker-combined-min.js’;
var _owa_s = document.getElementsByTagName(‘script’)[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);
}());
//]]>
</script>
<!– End Open Web Analytics Code –>
</header>
<body>
<h1>It works!</h1>
</body>
</html>
As you ca see here: https://github.com/Open-Web-Analytics/Open-Web-Analytics/wiki/Troubleshooting
OWA uses cookies for tracking and for logging not the the admin interface. Therefor you must run OWA under a fully qualified domain (FQD) such as my.domain.com. Accessing and running OWA under http://localhost or an IP address will create errors.
Hoe this helps you :)
There are a few issues with your HTML. For instance, you need to specify a doctype for your html tag. Also, should be .
I've cleaned up your code, but haven't check to see if this works. Give this a shot though:
<!DOCTYPE html>
<head>
<title>Blah</title>
<script>
//<![CDATA[
var owa_baseUrl = 'http://localhost/owa/';
var owa_cmds = owa_cmds || [];
owa_cmds.push(['setSiteId', '4f9312bd29c7edd4d492210b8599a383']);
owa_cmds.push(['trackPageView']);
owa_cmds.push(['trackClicks']);
owa_cmds.push(['trackDomStream']);
(function() {
var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;
owa_baseUrl = ('https:' == document.location.protocol ? window.owa_baseSecUrl || owa_baseUrl.replace(/http:/, 'https:') : owa_baseUrl );
_owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';
var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);
}());
//]]>
</script>
</head>
<body>
<h1>It works!</h1>
</body>
</html>

Google Plus button displaying wrong count

The Google+ button http://www.amayzinghomes.com is displaying the wrong count. This is a brand new domain so it should only be showing a few clicks. I think it may be displaying the number of clicks on the Google Plus page where I got the script instead of the count for the actual page it's on. Here's the script I used:
<!-- Place this tag where you want the +1 button to render. -->
<div class="g-plusone" data-size="tall" data-href="http://www.amayzinghomes.com/"></div>
<!-- Place this tag after the last +1 button tag. -->
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
s</script>
The most likely explanation is that the count of 7 comes from links shared on Google+.
I do see one public post via this search:
https://plus.google.com/u/0/s/amayzinghomes
There may be private posts with that URL too.
I have the same problem, https://plus.google.com/116401211377269068112 shows count over 180 while the JavaScript plugin shows only 13 on www.ceriseshirts.com . The code is given below
<div class="g-plusone" data-size="medium" data-annotation="bubble" data-width="60" data-height="69" data-href="https://plus.google.com/116401211377269068112"></div>
<script>
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>

Is it allowed to minify Google +1 button and Twitter's follow button?

I recently added a +1 button and the new Twitter's follow button and I would like to minify them.. Is minifying the button's script's is allowed?
It means that i would like to minify this for twitter:
<script type="text/javascript"> (function(){
var twitterWidgets = document.createElement('script');
twitterWidgets.type = 'text/javascript';
twitterWidgets.async = true;
twitterWidgets.src = '//platform.twitter.com/widgets.js';
document.getElementsByTagName('head')[0].appendChild(twitterWidgets);
})();
</script>
and this for google+:
<script type="text/javascript"> (function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script
I tried to check it out in thier FAQ section, but couldn't find anything.
Thanks in advanced, Din.
You can minify them if you want but minifying the dozen lines isn't going to make much of a difference. The amount of effort to minify them is probably more effort then the gain you will get.