• Resolved Imran Malik

    (@imranmalix)


    HI i’m using this affiliate plugin, which could add &affiliateid in any URL to become affiliate link. Thus i would like to automatically add/parse the affiliate id into the link my affiliate (logged in user) share using your plugin.

    I saw your instruction here, and understand this can be done. I changed below line to the affiliate plugin’s shortcode but its not working.

    Before: var hash_pi = ‘#3.1459’;

    After: var hash_pi = ‘&affiliate=[affiliates_id]’;

    currently i just use ‘&affiliate=’; and asked my affiliate to add their id manually. Can you help how to solve this please?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author micropat

    (@micropat)

    The Affiliates developer has an add-on that seems to integrate with AddToAny, but it requires their paid version.

    The AddToAny plugin’s Additional JavaScript box doesn’t parse shortcodes right now, but you could look into exposing the Affiliates ID in an HTML meta tag on your pages like:

    <meta name="affiliates-id" content="1">

    Then have your AddToAny share event grab the ID like:

    a2a_config.callbacks.push({
      share: function (shareData) {
        var affiliatesId = document.querySelector('meta[name="affiliates-id"]').getAttribute('content');
        if (affiliatesId) {
          return {
            url: shareData.url + '?affliates=' + affiliatesId,
          };
        }
      }
    });
    Thread Starter Imran Malik

    (@imranmalix)

    Many thanks! it worked. Based on your input, what i did was, updated as below

    <meta name="affiliates-id" content=[affiliates_id]>

    then include this in every post by using separate plugin and insert after content.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Modifying the share URL’ is closed to new replies.