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 querystring 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_twitter"></a>
    <a class="a2a_button_whatsapp"></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 = {
    app_id: "5303202981",
    redirect_uri: "https://static.addtoany.com/menu/thanks.html"
};

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

a2a_config.templates.twitter = {
    text: "Reading: ${title} ${link}",
    related: "AddToAny,Twitter"
};

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

<script async 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 = {
    app_id: "5303202981",
    redirect_uri: "https://static.addtoany.com/menu/thanks.html"
};

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

a2a_config.templates.twitter = {
    text: "Reading: ${title} ${link}",
    related: "AddToAny,Twitter"
};

a2a_config.templates.whatsapp = {
    phone: "15551234567",
    text: "I'm interested in ${title} posted here: ${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 Twitter, suggest relevant hashtags and related usernames by customizing Twitter's endpoint parameters.

https://twitter.com/intent/tweet&text=&hashtags=&related=

a2a_config.templates.twitter = {
    text: "Reading: ${title} ${link}",
    hashtags: "sharing,social",
    related: "AddToAny,Twitter"
};

For Facebook, you can set an App ID and a post-share URL by customizing Facebook's endpoint parameters.

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

a2a_config.templates.facebook = {
    app_id: "5303202981",
    redirect_uri: "",
    quote: ""
};

Facebook's app_id can be set to empty to revert to Facebook's old endpoint, which has less features and different parameters, but may support some publisher use cases.

Facebook's redirect_uri can be set to empty, or to a URL from one of the App Domains set for your Facebook app.

Facebook's quote set to empty can enable a large preview image when supplied, and can enable the "Boost Post" button on a managed Facebook Page.