I had to switch off Pinterest because the Javascript is spyware and is slowing down my sites.

The Pinterest Javascript is loaded from Pinterest.com instead of the module or a library. The Pinterest Javascript then logs every page request to log.pinterest.com. The Pinterest log request is the slowest http request in a page request on each site and, in some cases, doubles response time. The logging of page requests by a third party is also against the policies of most sites.

The activity would be acceptable on some of the sites if it was limited to the pages containing Pinterest buttons.

#9 pinterest.zip2.21 KBhaleagar
#1 pinterest_bad_javascript.png457.92 KBJawi
Members fund testing for the Drupal project. Drupal Association Learn more


Jawi’s picture

Title: Pinterest requesting file from Pinterest Web site on pages not showing Pinterest. » Having the same performance issues
Priority: Normal » Major
457.92 KB

The Pinterest Javascript is slowing down our sites.
Is their a strait forward way to run the javascripts locally - and only on the pages with the button active?

Our pageload is over 23 seconds.

Al ideas are welcome :)

Simon Georges’s picture

I'm not sure you're permitted to not use the official pinterest javascript (licensing issues, things like that).
Can somebody eventually point me towards the right documentation, so I can better understand what is or is not possible?
I'm not a Pinterest user, so I'm willing to integrate a patch, but I won't develop it myself.

Simon Georges’s picture

Priority: Major » Normal
Simon Georges’s picture

Title: Having the same performance issues » Pinterest performance issues
Jawi’s picture

For now I'm using the Share this module from a best practice on my other sites. https://drupal.org/project/sharethis
This is working as it should.

When issues with the pinterest button are solved, I'll test the service links again.

mstrelan’s picture

Issue summary: View changes

From https://developers.pinterest.com/pin_it/

Some companies aren't allowed to use third-party JavaScript. If you're working somewhere where you need to host a copy of our JavaScript, star this GitHub repository:

...and update your hosted copy whenever we push. We read all comments and pull requests, so don't hesitate to get in touch there.

Except I don't really see that helping, since pinit.js just calls pinit_main.js directly from the pinterest server too.

mstrelan’s picture

Additionally, you can load the Pinterest JS asynchronously.

    var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');
    p.type = 'text/javascript';
    p.async = true;
    p.src = '//assets.pinterest.com/js/pinit.js';
    f.parentNode.insertBefore(p, f);

It might be a bad idea to use jQuery.getScript() as that prevents the retrieved file from being cached in the browser.

Caching Responses

By default, $.getScript() sets the cache setting to false. This appends a timestamped query parameter to the request URL to ensure that the browser downloads the script each time it is requested. You can override this feature by setting the cache property globally using $.ajaxSetup():

haleagar’s picture

What about a no JS link only version of Pintrest not the widget?

haleagar’s picture

2.21 KB

OK so not quite as easy as I thought to add pinterest as simple link. The link needs an image.
But the widget services module shows exactly how to add a custom form to input a token for that and the description field, and use them in your service link.
I'm not using this, but I was just extending the twitter link to add a "via" option, and use an alternate token for description instead of teaser, so I whipped together a pinterest service module.

Not sure if it's worth submitting as a module to DO,
Nor do I see how to add this to http://servicelinks.altervista.org/

I believe it would be worthwhile to extend Service Links to allow you to set your token for Media and Description just as you can the title.
What says TheCrow?

GiorgosK’s picture

Status: Active » Needs work

#9 seems to work as expected
I wish there was a pinterest service together with the widget
but I guess in order to be integrated it needs work right ?