3

i wanted to get some opinions on the best way to track pining events as of today(11/30/12). It's my understanding pinterest is working on an api that will hopefully have real callbackmethods like fb or twitter does for it's buttons to tie into google analytics. but as of now, we have to work around best we can.

currently i wrap my pinterest link in a div, so after pinit.js does it's thing and creates the actual button, the html looks like this:

<div class="pin">
<a href="http://pinterest.com/pin/create/button/?url=mySite.com/path/to/content&description=yeah&media=yougetthepoint">
    <span class="PIN_1354295239838_hidden" id="PIN_1354295239838_pin_count_0"></span>
</a>                                        
</div>

my thought is to use jQuery to add in the track events on the pin div like so

$(document).ready(function() {
    $('div.pin').click(function() {
        _gaq.push(['_trackEvent', 'Pinterest Pins', 'Article Pin', $(location).attr('href')]);
    });
});

I know it doesn't 100% know that the user actually went through with the pinning process, but I'm not really sure what else to do than wait for a better api?

does this sound like a good way to do it for now to get some event tracking going in ga? or does anybody have some suggestions or tips on a better solution?

1
  • You should be using _trackSocial instead.
    – Eduardo
    Nov 30, 2012 at 18:56

1 Answer 1

3

Going to answer my own question here. I went ahead and implemented this jQuery function:

$(document).ready(function() {
    $('div.pin').click(function() {
        _gaq.push(['_trackSocial', 'Pinterest', 'Article Pin', $(location).attr('href')]);
    });
});

it finds the div that contains the pin button. whenever it gets clicked it will push a _trackSocial event. It seems to be working. I do the same thing for individual images that get pinned too:

$('div.pinIt').click(function() {
    var imageURL = $(this).closest('div.showPin').find('img.lazy').attr('data-lazy-src'); 
    _gaq.push(['_trackSocial', 'Pinterest', 'Image Pin', imageURL]);
});
1

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.