Humble
Humble

Reputation: 1

TYPO3 CMS version 10.4 with Powermail 8.4 Marketing Information

Powermail has empty marketing information (the one that is send via email). It's TYPO3 v. 10.4 and Powermail 8.4.1 What please is the best way to track down where the error occurs? Debugging shows an empty array. Cookies are enabled in the browser that I use to send the form.

Upvotes: 0

Views: 212

Answers (1)

Christoph Dietrich
Christoph Dietrich

Reputation: 13

I could narrow it down to a bug in the Marketing.js respectively in the Marketing.min.js file.

The file uses the fetch API to send the marketing data to the server. In the browsers developer tools network view you can see, that all data are transmitted as a joined string instead of separated key/value pairs. The argument body of the fetch function is in the wrong format:

  #sendMarketingInformation() {
    const marketingInformation = document.querySelector('#powermail_marketing_information');
    const url = marketingInformation.getAttribute('data-url');
    let data = '';
    data += 'tx_powermail_pi1[language]=' + marketingInformation.getAttribute('data-language');
    data += '&id=' + marketingInformation.getAttribute('data-pid');
    data += '&tx_powermail_pi1[pid]=' + marketingInformation.getAttribute('data-pid');
    data += '&tx_powermail_pi1[mobileDevice]=' + (this.#isMobile() ? 1 : 0);
    data += '&tx_powermail_pi1[referer]=' + encodeURIComponent(document.referrer);

    fetch(url, {method: 'POST', body: data, cache: 'no-cache'});
  };

I could fix it in #sendMarketingInformation() with my own version of the Marketing.js file:

#sendMarketingInformation() {
    const marketingInformation = document.querySelector('#powermail_marketing_information');
    const url = marketingInformation.getAttribute('data-url');

    let data = new URLSearchParams();
    data.append('tx_powermail_pi1[language]', marketingInformation.getAttribute('data-language'));
    data.append('id', marketingInformation.getAttribute('data-pid'));
    data.append('tx_powermail_pi1[pid]', marketingInformation.getAttribute('data-pid'));
    data.append('tx_powermail_pi1[mobileDevice]', (this.#isMobile() ? 1 : 0));
    data.append('tx_powermail_pi1[referer]', document.referrer);

    fetch(url, {method: 'POST', body: data, cache: 'no-cache'});
};

Upvotes: 0

Related Questions