Upgrading from the legacy widget is as simple as replacing the older integration script with the new one, which you can find in the admin.

Since the Beta widget tracks activity using links instead of 3rd party cookies, you can freely remove any cookie tracking scripts that were previously necessary for the legacy widget, this should simplify the integration a bit.

Any new links generated by the Beta widget will work retroactively with any legacy invites so you can upgrade to the new widget without having to worry about missing out on any activity from older invites or creating a new campaign.

Load the Legacy widget with the new integration script

If you’re not ready to fully commit to the Beta widget, you have the option of using the new integration script to load the Legacy widget. 

The new script is backwards compatible so with a few adjustments to the code you can use it to load the older widget. Using the new integration script will also allow you to use the legacy widget without the additional cookie tracking script since it has been incorporated in the JS SDK instead.

Script Changes

Two adjustments need to be made to the integration script to support this:

  • Change the line that specifies the version from version: 'latest' to version: 'v1'

  • Include addTransaction() function needed to log legacy influencers and transactions

Keep in mind, any addTransaction() attributes will need to have their values adjusted to match the equivalents in your site.

Code Example

After making these changes, the resulting code will look something like this:

<script>
    window.onIcsLoaded = function() {
      ICS.init({
        version: 'v1',
        publicKey: 'REPLACE',
        campaignId: 'REPLACE',
      });

  ics('addTransaction', {
    orderId: '{{order.order_number}}',
    email: '{{order.email}}',
    revenue: '{{checkout.line_items_subtotal_price | money_without_currency}}',
    name: '{{customer.name}}',
    inviteCookie: (document.cookie.match(/invite=([a-zA-Z0-9%]+)/) || [null] )[0],
    transactionId: '{{transactions[0].receipt.transaction_id}}',
  });
  };

</script>
<script async defer crossorigin="anonymous" src="https://js.icecreamsocial.io/sdk.js" />