Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nickveenhof/3f58557910cf1cc3c91385735592ea9f to your computer and use it in GitHub Desktop.
Save nickveenhof/3f58557910cf1cc3c91385735592ea9f to your computer and use it in GitHub Desktop.

Dropsolid Personalisation 1 on 1

Required

`php working

Installation

Install drupal

mkdir drupal && cd drupal && curl -sSL https://www.drupal.org/download-latest/tar.gz | tar -xz --strip-components=1

installing compser

Fetch the unomi module module

composer require drupal/unomi:2.x-dev

Fetch the personalisation module module

composer require drupal/dropsolid_personalisation:1.x-dev

Fetch the mautic paragraph module

composer require drupal/mautic_paragraph:1.x-dev

Fetch the asset injector module

composer require drupal/asset_injector

Start the Drupal site!

Command that gives you the admin login link: php ./core/scripts/drupal quick-start demo_umami Command that is more stable without login link: php ./core/scripts/drupal quick-start demo_umami -s -vvv

Check Page cache

Internal Page Cache module Should be disabled

Surf to : http://drupal.localhost:8888/en/admin/modules/uninstall

Disable the module.

Enable the fetched modules

Manually enable modules dropsolid_personalisation & mautic_paragraph & asset_injector

http://drupal.localhost:8888/en/admin/modules

This should give you no errors.

Inject Scripts

Find personalisation script

in the dropsolid Platform, under CDP >capture, find your capture script. https://platform.dropsolid.com/personalisation/13/info?tab=capture

  (function(d) {
    // attach script tag and defer
    function downloadJSAtOnload() {
      var wf = d.createElement('script'), s = d.scripts[0];
      wf.src = 'https://datacapture.dropsolid.com/8ac23bbf-5e59-4635-92f6-a477ea45542b/capture.js'
      wf.defer = true;
      wf.setAttribute( 'data-cdp-uuid', '8ac23bbf-5e59-4635-92f6-a477ea45542b' );
      wf.setAttribute( 'data-region', 'europe-west1' );
      s.parentNode.insertBefore(wf, s);
    }
    downloadJSAtOnload();
  })(document);

Save personalisation script

Navigate to /en/admin/config/development/asset-injector/js on your website. Click "Add js injector" Enter a name for the script e.g. "personalisation". Under 'Code', paste the javascript code without the <script> tags

Save UTM script

 window.dsdc = window.dsdc || function() {(dsdc.q = dsdc.q || []).push(arguments)}; dsdc.l = +new Date;
 window.dsdc('beforeRequest', function(data) {
     changedCapture = data.requestData;
     urlParams = new URLSearchParams(window.location.search);
     utmCampaign = urlParams.get('utm_campaign');
     utmSource = urlParams.get('utm_source');
     changedCapture.te__utmCampaign = utmCampaign;
     changedCapture.te__utmSource = utmSource;
     dsdc.updateCapture(changedCapture);
 });

Couple Dropsolid personalisation to Drupal

Find Personalisation credentials

  • Navigate to https://platform.dropsolid.com/personalisation/
  • Click on your instance.
  • Click in info.
  • Copy the HOST / PORT / PAth / CLient ID & Secret from here.

⚠️Warning: Generating a new secret renders the previous one unusable. Do not do this ;)

Save Personalisation credentials

Navigate to /en/admin/config/services/unomi on your drupal installation.

  • select Dropsolid platform
  • florista01-unomi-florista.dropsolid-sites.com
  • Select https
  • Enter the Host, port, Username and password (key & secret).

Add custom Block

  • Navigate to /en/admin/structure/block
  • Click on Place block next to Content
  • Select "Add custom block"
  • Choose the Type Basic Block You are now creating your basic block.
  • Input relevant title / description
  • Select the Personalisation "Segment" you wish the block to appear for.
  • "Save"

Test!

Test with the chrome extension!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment