Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Error in AdvertisingConversionExport #20190

djmetzle opened this issue Jan 10, 2023 · 7 comments

Type Error in AdvertisingConversionExport #20190

djmetzle opened this issue Jan 10, 2023 · 7 comments
answered For when a question was asked and we referred to forum or answered it.


Copy link

djmetzle commented Jan 10, 2023

Similar issue to: #20189

Expected Behavior

Tracking requests are processed without errors.

Current Behavior

Type Errors occur in the `AdvertisingConversionExport` plugin when tracking hits include array for GET parameters:
Uncaught exception in /var/www/html/plugins/AdvertisingConversionExport/Tracker/RequestProcessor.php line 96:
parse_url(): Argument #1 ($url) must be of type string, array given
#0 /var/www/html/plugins/AdvertisingConversionExport/Tracker/RequestProcessor.php(96): parse_url(Array, 6)
#1 /var/www/html/plugins/AdvertisingConversionExport/Tracker/RequestProcessor.php(41): Piwik\Plugins\AdvertisingConversionExport\Tracker\RequestProcessor->getClickIdAndProviderFromRequest(Object(Piwik\Tracker\Request))
#2 /var/www/html/core/Tracker/Visit.php(154): Piwik\Plugins\AdvertisingConversionExport\Tracker\RequestProcessor->manipulateRequest(Object(Piwik\Tracker\Request))
#3 /var/www/html/core/Tracker.php(172): Piwik\Tracker\Visit->handle()
#4 /var/www/html/plugins/QueuedTracking/Queue/Processor/Handler.php(46): Piwik\Tracker->trackRequest(Object(Piwik\Tracker\Request))
#5 /var/www/html/plugins/QueuedTracking/Queue/Processor.php(194): Piwik\Plugins\QueuedTracking\Queue\Processor\Handler->process(Object(Piwik\Tracker), Object(Piwik\Tracker\RequestSet))
#6 /var/www/html/plugins/QueuedTracking/Queue/Processor.php(143): Piwik\Plugins\QueuedTracking\Queue\Processor->processRequestSets(Object(Piwik\Tracker), Array)
#7 /var/www/html/plugins/QueuedTracking/Commands/Process.php(86): Piwik\Plugins\QueuedTracking\Queue\Processor->process()
#8 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\QueuedTracking\Commands\Process->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plug<!-- When describing a bug, please tell us what should happen -->
<!-- When suggesting a change/improvement, please tell us how it should work -->
ins\QueuedTracking\Commands\Process), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/core/Console.php(135): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /var/www/html/core/Access.php(670): Piwik\Console->Piwik\{closure}()
#14 /var/www/html/core/Console.php(136): Piwik\Access::doAsSuperUser(Object(Closure))
#15 /var/www/html/core/Console.php(87): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/console(32): Symfony\Component\Console\Application->run()
#18 {main}

Possible Solution

We are working with this patch to AdvertisingConversionExport/Tracker/RequestProcessor.php:

--- RequestProcessor.php
+++ Patched.php
@@ -93,7 +93,8 @@
         $rawParams = $request->getRawParams();
-        parse_str(parse_url($rawParams['url'] ?? '', PHP_URL_QUERY) ?? '', $params);
+        $rawUrl = is_string($rawParams['url']) ? $rawParams['url'] : ''; 
+        parse_str(parse_url($rawUrl, PHP_URL_QUERY) ?? '', $params);
         foreach ($providers as $provider) {
             if (empty($provider::CLICK_ID_REQUEST_PARAM)) {

This is a premium plugin, so it is not easy to get a diff, nor to create an issue on the plugin repo.

Steps to Reproduce (for Bugs)

Tracking hits include utm_campaign[]=.... form get parameters that decode into arrays, not simple strings.


These are "bad" tracking hits, in the sense that utm_campaign[]=... are not technically correct, but we should not be failing hard on processing these hits. Specifically, these errors stall out processing while using the QueuedTracking plugin, and stall all processing of the queue, similar to matomo-org/plugin-QueuedTracking#192

Your Environment

  • Matomo Version: 4.12.3
  • PHP Version: 8.0.26
  • Server Operating System: Docker (alpine) (running on Fedora)
  • Additionally installed plugins:
    • CustomReports
    • MarketingCampaignsReporting
    • CustomAlerts
    • LogViewer
    • InvalidateReports
    • TasksTimetable
    • QueuedTracking
    • AbTesting
    • MediaAnalytics
    • FormAnalytics
    • Funnels
    • RollUpReporting
    • SearchEngineKeywordsPerformance
    • MultiChannelConversionAttribution
    • HeatmapSessionRecording
    • SEOWebVitals
    • UsersFlow
    • ActivityLog
    • WhiteLabel
    • Cohorts
    • AdvertisingConversionExport
    • LoginSaml
    • WooCommerceAnalytics
    • CustomVariables
    • GoogleAnalyticsImporter
@djmetzle djmetzle added Potential Bug Something that might be a bug, but can't be reproduced (yet). To Triage An issue awaiting triage by a Matomo core team member labels Jan 10, 2023

This issue has been mentioned on Matomo forums. There might be relevant details there:

Copy link

sgiehl commented Jan 11, 2023

@AltamashShaikh could you have a look at this one pls.

Copy link

@sgiehl I will have a look

Copy link

@djmetzle For issue w.r.t premium features please contact which will help you get an answer quickly.

Anyways I tried replicating the issue by creating the URL something like this[]=1&utm_campaign[]=2 and I can see this works though

Screenshot from 2023-01-11 15-58-58

Do you have a example URL where we can reproduce this ?

Copy link

Hey @AltamashShaikh, sorry to leave you hanging!

I've posted a detailed comment about our situation here:
#20189 (comment)

These recent troubles all seem related to type errors caused by a (potential?) bug in UrlHelper, and recent changes to DeviceDetector?
I've been sweeping the forums and the issues on the main matomo repo, and these errors seem (to me at least) similar and related.

Copy link

@djmetzle Cannot find a sample URL in the above comment, it would be good to share the sample URL causing such issue, so that we can debug and fix it.

Just FYI, I tried hitting the same URL by enabling QueuedTracking plugin and tried to process the queue later to replicate the issue and it worked as expected

Copy link

sgiehl commented Feb 9, 2023

Closing this issue here as it's for a premium plugin, which we can't handle here.
@djmetzle If you still have an issue around that, please contact our support team. Thanks.

@sgiehl sgiehl closed this as not planned Won't fix, can't repro, duplicate, stale Feb 9, 2023
@sgiehl sgiehl added answered For when a question was asked and we referred to forum or answered it. and removed Potential Bug Something that might be a bug, but can't be reproduced (yet). To Triage An issue awaiting triage by a Matomo core team member labels Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
answered For when a question was asked and we referred to forum or answered it.
None yet

No branches or pull requests

4 participants