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

Make mtm_cid case sensitive #65

Merged
merged 4 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Campaign/CampaignDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ protected function getValueFromQueryString($param, $queryString)
{
$valueFromRequest = UrlHelper::getParameterFromQueryString($queryString, $param);
$valueFromRequest = trim(urldecode($valueFromRequest));
$valueFromRequest = Common::mb_strtolower($valueFromRequest);
if ($param != "mtm_clid") {
$valueFromRequest = Common::mb_strtolower($valueFromRequest);
sgiehl marked this conversation as resolved.
Show resolved Hide resolved
}
chopsol marked this conversation as resolved.
Show resolved Hide resolved
$valueFromRequest = substr($valueFromRequest, 0, 250);
if (!empty($valueFromRequest)) {
return $valueFromRequest;
Expand Down
2 changes: 1 addition & 1 deletion MarketingCampaignsReporting.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MarketingCampaignsReporting extends Plugin
public static $CAMPAIGN_SOURCE_FIELD_DEFAULT_URL_PARAMS = array('mtm_source', 'pk_source', 'utm_source');
public static $CAMPAIGN_MEDIUM_FIELD_DEFAULT_URL_PARAMS = array('mtm_medium', 'pk_medium', 'utm_medium');
public static $CAMPAIGN_CONTENT_FIELD_DEFAULT_URL_PARAMS = array('mtm_content', 'pk_content', 'utm_content');
public static $CAMPAIGN_ID_FIELD_DEFAULT_URL_PARAMS = array('mtm_cid', 'pk_cid', 'utm_id');
public static $CAMPAIGN_ID_FIELD_DEFAULT_URL_PARAMS = array('mtm_cid', 'pk_cid', 'utm_id', 'mtm_clid');
public static $CAMPAIGN_GROUP_FIELD_DEFAULT_URL_PARAMS = array('mtm_group', 'pk_group');
public static $CAMPAIGN_PLACEMENT_FIELD_DEFAULT_URL_PARAMS = array('mtm_placement', 'pk_placement');

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ campaign_keyword = "mtm_keyword,matomo_kwd,mtm_kwd,utm_term"
campaign_source = "mtm_source,utm_source"
campaign_medium = "mtm_medium,utm_medium"
campaign_content = "mtm_content,utm_content"
campaign_id = "mtm_cid,utm_id"
campaign_id = "mtm_cid,utm_id,mtm_clid"
campaign_group = "mtm_group"
campaign_placement = "mtm_placement"
```

For example, by default parameter `campaign_name` track following parameters if they are found in URL: `'mtm_campaign', 'matomo_campaign', 'mtm_cpn', 'utm_campaign'`. If you configure `campaign_name` like this `campaign_name="mtm_campaign,custom_name_parameter"`, then parameter `campaign_name` will detect only presence of `mtm_campaign` and `custom_name_parameter` in URL. `matomo_campaign`, `mtm_cpn`, `utm_campaign` will be ignored until they are present in config.

All parameter are case-insensitiv except optional mtm_clid.

## Changelog

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Campaign/CampaignDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function getCampaignParameters()
(new CampaignSource())->getColumnName() => ['mtm_source', 'utm_source'],
(new CampaignMedium())->getColumnName() => ['mtm_medium', 'utm_medium'],
(new CampaignContent())->getColumnName() => ['mtm_content', 'utm_content'],
(new CampaignId())->getColumnName() => ['mtm_cid', 'utm_id'],
(new CampaignId())->getColumnName() => ['mtm_cid', 'utm_id', 'mtm_clid'],
];
}

Expand Down