Sharing Customization

Templates & Endpoint Parameters

With AddToAny templates, you can you can change the default text sent to many services, and you can add or override any query string parameter for any service endpoint URL.

Template Examples

<div class="a2a_kit a2a_kit_size_32 a2a_default_style">
    <a class="a2a_button_email"></a>
    <a class="a2a_button_facebook"></a>
    <a class="a2a_button_sms"></a>
    <a class="a2a_button_whatsapp"></a>
    <a class="a2a_button_x"></a>
</div>

<script>
var a2a_config = a2a_config || {};
a2a_config.templates = a2a_config.templates || {};

a2a_config.templates.email = {
    subject: "Check this out: ${title}",
    body: "Click the link:\n${link}",
};

a2a_config.templates.facebook = {
    hashtag: "#AddToAny",
};

a2a_config.templates.sms = {
    body: "Check this out: ${title} ${link}",
};

a2a_config.templates.whatsapp = {
    phone: "15551234567",
    text: "I'm interested in ${title} posted here: ${link}",
};

a2a_config.templates.x = {
    text: "Check this out: ${title} ${link}",
};
</script>

<script defer src="https://static.addtoany.com/menu/page.js"></script>

In Drupal, add the following JavaScript code to your "Additional JavaScript" box in Configuration > Web services > AddToAny > Additional Options.

In WordPress, add the following JavaScript code to your "Additional JavaScript" box in Settings > AddToAny.

a2a_config.templates.email = {
    subject: "Check this out: ${title}",
    body: "Click the link:\n${link}",
};

a2a_config.templates.facebook = {
    hashtag: "#AddToAny",
};

a2a_config.templates.sms = {
    body: "Check this out: ${title} ${link}",
};

a2a_config.templates.whatsapp = {
    phone: "15551234567",
    text: "I'm interested in ${title} posted here: ${link}",
};

a2a_config.templates.x = {
    text: "Check this out: ${title} ${link}",
};

Use the ${link} and ${title} placeholders to designate where you want the shared link and title to be placed.

Tip: You can use AddToAny events to modify AddToAny templates during the share event.


Parameter Examples

For Facebook, you can set an optional App ID and/or hashtag by customizing Facebook's endpoint parameters.

https://www.facebook.com/dialog/share?app_id=&hashtag=&href=

a2a_config.templates.facebook = {
    app_id: "5303202981",
    hashtag: "#AddToAny",
};

Facebook's app_id can be set to a Facebook App ID, but this is optional.

Facebook's hashtag can be set to add a single hashtag to shared content.

Facebook has deprecated the quote and redirect_uri parameters.