Drupal Sharing Customization

Thanks for Sharing

The post-share "Thanks for sharing!" modal encourages more sharing and may optionally display an ad unit.

Currently, AddToAny displays the post-share modal on pages that have an existing ad tag. The modal's ad unit is only displayed by default on pages that have an existing ad tag. You can enable or disable the modal and the ad unit. You can also add your own ad tag to be rotated along with AddToAny's.

Configuring Thanks

<div class="a2a_kit a2a_kit_size_32 a2a_default_style">
    <a class="a2a_dd"></a>
    <a class="a2a_button_facebook"></a>
    <a class="a2a_button_mastodon"></a>
    <a class="a2a_button_email"></a>
</div>

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

a2a_config.thanks = {
    postShare: true,
    ad: true,
};
</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.thanks = {
    postShare: true,
    ad: true,
};

Show Thanks

Enable the post-share "Thanks for sharing!" modal.

a2a_config.thanks = {
    postShare: true,
};

No Thanks

Disable the post-share "Thanks for sharing!" modal.

a2a_config.thanks = {
    postShare: false,
};

Enable Ad

Enable AddToAny's ad unit in your "Thanks for sharing!" modal. (Thank you!)

a2a_config.thanks = {
    postShare: true,
    ad: true,
};

Add Your Ad Unit

You can set an ad tag for your own ad unit to be rotated along with AddToAny's ad unit when the "Thanks for sharing!" modal is displayed. Like a coin toss, rotation uses Math.random() to give both ad units about a 50% chance of display. To add an ad tag, set the ad tag HTML code as a string value of the a2a_config.thanks.ad property.

Note: JavaScript strings require some characters and HTML tags to be escaped with a backslash. The tool below does the escaping for you.

Input your ad tag code into the box below, then press the Update button to generate your configuration code.


a2a_config.thanks = {
    postShare: true,
    ad: '<ins class=\"adsbygoogle\"\
            style=\"display:inline-block;width:300px;height:250px\"\
            data-ad-client=\"ca-pub-xxxxxxxxxxxxxxxx\"\
            data-ad-slot=\"1234567890\"></ins>\
        <\script>\
        (adsbygoogle = window.adsbygoogle || []).push({});\
        <\/script>',
};

Disable Ad

Disable the ad unit in your "Thanks for sharing!" modal.

a2a_config.thanks = {
    postShare: true,
    ad: false,
};