← back to the blog


use gigya to share

Posted in Jade, JavaScript by dake

Gigya provides social share feature, include facebook, google plus's share, comment and tons of other features to engage your website and the user.

http://www.gigya.com/products/add-ons/social-engagement/ 

This blog shows very simple way to imprement this, first you need to go to gigya.com to register and get a account.

Once you get a account, following is simple code written by jade to add comment area.

 

Gigya comment module written in jade

 
	.container
		#commentsArea
	script(type='text/javascript').
		var params ={
		categoryID: 'technology',
		streamID: window.location.pathname,
		version: 2,
		containerID: 'commentsArea',
		cid:'',
		enabledShareProviders: 'facebook,twitter,yahoo,linkedin,googleplus'
		}
		gigya.comments.showCommentsUI(params);

Gigya comment module written in javascript


<div class="container">
      <div id="commentsArea"></div>
    </div>
    <script type="text/javascript">
      var params ={
      categoryID: 'technology',
      streamID: window.location.pathname,
      version: 2,
      containerID: 'commentsArea',
      cid:'',
      enabledShareProviders: 'facebook,twitter,yahoo,linkedin,googleplus'
      }
      gigya.comments.showCommentsUI(params);
      
      
    </script>

Gigya shared module written in jade


	script(type='text/javascript').
		var act = new gigya.socialize.UserAction();
		var thisUrl = window.location.href;
		var imageSrc = $("img.img-responsive")[0] || '';
		act.setTitle($("header h1").text());
		act.setLinkBack(thisUrl);
		act.addMediaItem({ type: 'image', src: imageSrc, href: thisUrl });
		var showShareBarUI_params=
		{
		containerID: 'shareDiv',
		shareButtons: 'Facebook-Like,Twitter-Tweet,googleplus-share,LinkedIn',
		userAction: act
		}
	script(type='text/javascript').
		gigya.socialize.showShareBarUI(showShareBarUI_params);

Gigya shared module written in javascript


  <script type="text/javascript">
      var act = new gigya.socialize.UserAction();
      var thisUrl = window.location.href;
      var imageSrc = $("img.img-responsive")[0] || '';
      act.setTitle($("header h1").text());
      act.setLinkBack(thisUrl);
      act.addMediaItem({ type: 'image', src: imageSrc, href: thisUrl });
      var showShareBarUI_params=
      {
      containerID: 'shareDiv',
      shareButtons: 'Facebook-Like,Twitter-Tweet,googleplus-share,LinkedIn',
      userAction: act
      }
    </script>
    <script type="text/javascript">gigya.socialize.showShareBarUI(showShareBarUI_params);</script>

Reference

gigya documents