What happened to the articles?
You might have noticed that our support portal looks a bit different. We decided to do a little tidying up, so moving forward, support articles will be updated and housed on the AddThis Academy. For the most up to date articles, as well as other support documentation, please visit us at If you need additional help, you can submit a help ticket using the form below. Thanks!
Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Email template when using AJAX (bug)

danielcampos Mar 21, 2012 @ 08:52AM EDT
In fact, it's not a question, but the description of a bug and how I solved it.

One of my projects is using the AddThis sharing buttons in some screens, and since the application is entirely in AJAX, the AddThis should be loaded and restarted every time.

Well, a lot of ways about how to do that can be found through Web (some code of how to do that, below... where is YOUR-ID, put your id, for example ra-4asd2...). The problem itself was using custom templates for the email functionality.

var script = '';
if (window.addthis){
window.addthis = null;
$.getScript( script , function() { addthis.init(); });

I tested a lot of ways, but the new default template or the configured template wasn't used when loading dynamically the AddThis library, it only worked on normal non-AJAX requests.

Analysing over and over again, I've found some parameter that was blank, when the template wasn't used, but with my ID in a successfully sharing email: the parameter 'pub'
Hey! So that's the problem, the AddThis didn't know what account was trying to make the request so it didn't find the right template and used the standard.

So my solution was set the pubid manually every time the AddThis is reloaded, so that value is used to populate the parameter 'pub' and the right profile template is got :)
I can do that with line below (again, where is YOUR-ID, put your id, for example ra-4asd2...):

var addthis_config = { pubid: 'YOUR-ID'};

And everything worked as it should :)

I didn't find anything regarding this problem or solution in documentation. So I guess it should be done automatically or something written in the AJAX section of API documentation.

I hope it helps someone.

Daniel Campos
Paul Mar 21, 2012 @ 10:51AM EDT AddThis Happiness Specialist
Thanks for documenting this! I'm sure it will help someone.
Up 0
Down rated

This question has received the maximum number of answers.
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found