Login   Register  
PHP Classes
elePHPant
Icontem

File: templates/linkedin/script.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mike  >  PHP Socializer  >  templates/linkedin/script.js  >  Download  
File: templates/linkedin/script.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Socializer
Embed social buttons and widgets in Web pages
Author: By
Last change:
Date: 2013-01-08 00:16
Size: 1,566 bytes
 

Contents

Class file image Download
_socialQueue.push({
    url: '//platform.linkedin.com/in.js',
    id: '<?php echo $this->name; ?>',
    onload: function(f) {

        // Google Analytics tracking
        // @todo check if Linked in callbacks are working & update this
        var trackerName = _ga.buildTrackerName_();
        _ga.trackLinkedIn = {
            // LinkedIn callbacks seem broken, I've included these anyway...
            success: function() {
                _gaq.push([trackerName + '_trackSocial', 'linkedin', 'share', targetUrl, opt_pageUrl]);
            },
            error: function() {
                _gaq.push([trackerName + '_trackSocial', 'linkedin', 'error', targetUrl, opt_pageUrl]);
            }
         };
         // If jQuery is present, bind a click event to the linked in anchor and let Google know about any clicks we capture
         if (typeof jQuery !== 'undefined') {
            $('.IN-widget').click(function(){
                _gaq.push([trackerName + '_trackSocial', 'linkedin', 'click', $(this).parents('div.coi-social-button-linkedIn').find('script').data('url')]);
            });
        }

        // Fade button in if desired
        if ('<?php echo $this->fadeIn ?>') {
            f.awaitRender({
                buttons: document.getElementsByClassName('coi-social-button-<?php echo $this->name; ?>'),
                duration: '<?php echo $this->fadeIn; ?>',
                isRendered: function(element) {
                    return element.getElementsByClassName('IN-widget').length;
                }
            });
        }
    }
});