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

Add campaign tracking parameters for all links within Matomo app that link to matomo.org #701

Merged
merged 7 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 2 deletions Context/WebContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public function getInstallInstructions($container, $environment)
return [[
'description' => Piwik::translate('TagManager_ContextWebInstallInstructions', array('<head>')),
'embedCode' => $embedCode,
'helpUrl' => 'https://developer.matomo.org/guides/tagmanager/embedding'
'helpUrl' => Url::addCampaignParametersToMatomoLink('https://developer.matomo.org/guides/tagmanager/embedding', null, null, 'App.TagManager.getInstallInstructions')
]];
}

Expand Down Expand Up @@ -295,7 +295,7 @@ public function getInstallInstructionsReact($container, $environment)
return [[
'description' => Piwik::translate('TagManager_ContextWebInstallInstructions', array('<head>')),
'embedCode' => $embedCode,
'helpUrl' => 'https://developer.matomo.org/guides/tagmanager/embedding',
'helpUrl' => Url::addCampaignParametersToMatomoLink('https://developer.matomo.org/guides/tagmanager/embedding', null, null, 'App.TagManager.getInstallInstructionsReact'),
'pageViewTriggerEditUrl' => $this->getPageViewTriggerEditUrl($container['idsite'], $container['idcontainer'])
]];
}
Expand Down
42 changes: 21 additions & 21 deletions Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function dashboard()
Piwik::translate('TagManager_DashboardHelp2'),
Piwik::translate('TagManager_DashboardHelp3'),
Piwik::translate('TagManager_DashboardHelp4', [
'<a href="https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
]),
]
Expand All @@ -92,12 +92,12 @@ public function dashboard()
$tagsHelpText = $this->renderTemplate('helpContent', [
'paragraphs' => [
Piwik::translate('TagManager_DashboardTagsHelp1', [
'<a href="https://matomo.org/guide/tag-manager/tags/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/tags/') . '" rel="noreferrer noopener" target="_blank">',
'</a>'
]),
Piwik::translate('TagManager_DashboardTagsHelp2'),
Piwik::translate('TagManager_DashboardTagsHelp3', [
'<a href="https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
]),
]
Expand All @@ -106,12 +106,12 @@ public function dashboard()
$triggersHelpText = $this->renderTemplate('helpContent', [
'paragraphs' => [
Piwik::translate('TagManager_DashboardTriggersHelp1', [
'<a href="https://matomo.org/guide/tag-manager/triggers/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/triggers/') . '" rel="noreferrer noopener" target="_blank">',
'</a>'
]),
Piwik::translate('TagManager_DashboardTriggersHelp2'),
Piwik::translate('TagManager_DashboardTriggersHelp3', [
'<a href="https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
]),
]
Expand All @@ -120,12 +120,12 @@ public function dashboard()
$variablesHelpText = $this->renderTemplate('helpContent', [
'paragraphs' => [
Piwik::translate('TagManager_DashboardVariablesHelp1', [
'<a href="https://matomo.org/guide/tag-manager/variables/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/variables/') . '" rel="noreferrer noopener" target="_blank">',
'</a>'
]),
Piwik::translate('TagManager_DashboardVariablesHelp2'),
Piwik::translate('TagManager_DashboardVariablesHelp3', [
'<a href="https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
]),
]
Expand All @@ -134,12 +134,12 @@ public function dashboard()
$versionsHelpText = $this->renderTemplate('helpContent', [
'paragraphs' => [
Piwik::translate('TagManager_DashboardVersionsHelp1', [
'<a href="https://matomo.org/guide/tag-manager/versions-and-publish/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/versions-and-publish/') . '" rel="noreferrer noopener" target="_blank">',
'</a>'
]),
Piwik::translate('TagManager_DashboardVersionsHelp2'),
Piwik::translate('TagManager_DashboardVersionsHelp3', [
'<a href="https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/tag-manager/container-dashboard-in-matomo-tag-manager/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
]),
]
Expand Down Expand Up @@ -172,11 +172,11 @@ public function manageTags()
'paragraphs' => [
Piwik::translate('TagManager_ManageTagsHelp2'),
Piwik::translate('TagManager_ManageTagsHelp3', [
'<a href="https://matomo.org/guide/tag-manager/tags/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/tags/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
'<a href="https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
'<a href="https://matomo.org/tag-manager-training/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/tag-manager-training/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
]),
]
Expand All @@ -192,11 +192,11 @@ public function manageTriggers()
'paragraphs' => [
Piwik::translate('TagManager_ManageTriggersHelp2'),
Piwik::translate('TagManager_ManageTriggersHelp3', [
'<a href="https://matomo.org/guide/tag-manager/triggers/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/triggers/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
'<a href="https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
'<a href="https://matomo.org/tag-manager-training/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/tag-manager-training/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
]),
]
Expand All @@ -214,11 +214,11 @@ public function manageVariables()
'paragraphs' => [
Piwik::translate('TagManager_ManageVariablesHelp2'),
Piwik::translate('TagManager_ManageVariablesHelp3', [
'<a href="https://matomo.org/guide/tag-manager/variables/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/variables/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
'<a href="https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
'<a href="https://matomo.org/tag-manager-training/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/tag-manager-training/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
]),
]
Expand All @@ -238,11 +238,11 @@ public function manageVersions()
'paragraphs' => [
Piwik::translate('TagManager_ManageVersionsHelp2'),
Piwik::translate('TagManager_ManageVersionsHelp3', [
'<a href="https://matomo.org/guide/tag-manager/versions-and-publish/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/versions-and-publish/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
'<a href="https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/tag-manager/getting-started-with-tag-manager/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
'<a href="https://matomo.org/tag-manager-training/" rel="noreferrer noopener" target="_blank">',
'<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/tag-manager-training/') . '" rel="noreferrer noopener" target="_blank">',
'</a>',
]),
]
Expand Down
3 changes: 2 additions & 1 deletion Template/Tag/CustomHtmlTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Piwik\Piwik;
use Piwik\Settings\FieldConfig;
use Piwik\Url;
use Piwik\Validators\NotEmpty;

class CustomHtmlTag extends BaseTag
Expand Down Expand Up @@ -38,7 +39,7 @@ public function getParameters()
$field->customFieldComponent = self::FIELD_TEXTAREA_VARIABLE_COMPONENT;
$field->uiControl = FieldConfig::UI_CONTROL_TEXTAREA;
$field->description = Piwik::translate('TagManager_CustomHtmlTagDescriptionText');
$field->inlineHelp = Piwik::translate('TagManager_CustomHtmlTagHelpText', array('<a href="https://matomo.org/faq/tag-manager/faq_26815/">', '</a>'));
$field->inlineHelp = Piwik::translate('TagManager_CustomHtmlTagHelpText', ['<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/tag-manager/faq_26815/', null, null, 'App.TagManager.getParameters') . '">', '</a>']);
$field->validators[] = new NotEmpty();
}),
$this->makeSetting('htmlPosition', 'bodyEnd', FieldConfig::TYPE_STRING, function (FieldConfig $field) {
Expand Down
7 changes: 5 additions & 2 deletions Template/Variable/MatomoConfigurationVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Piwik\SettingsPiwik;
use Piwik\Site;
use Piwik\Tracker\TrackerCodeGenerator;
use Piwik\Url;
use Piwik\Validators\CharacterLength;
use Piwik\Validators\NotEmpty;
use Piwik\Validators\NumberRange;
Expand Down Expand Up @@ -223,7 +224,8 @@ public function getParameters()
$this->makeSetting('disableBrowserFeatureDetection', false, FieldConfig::TYPE_BOOL, function (FieldConfig $field) {
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoDisableBrowserFeatureDetectionTitle');
$field->description = Piwik::translate('TagManager_MatomoConfigurationMatomoDisableBrowserFeatureDetectionDescription');
$field->inlineHelp = Piwik::translate('TagManager_MatomoConfigurationMatomoDisableBrowserFeatureDetectionInLineHelp', array('<br><strong>', '<a href="https://matomo.org/faq/how-to/how-do-i-disable-browser-feature-detection-completely/" target="_blank" rel="noreferrer noopener">', '</a>', '</strong>'));
$field->inlineHelp = Piwik::translate('TagManager_MatomoConfigurationMatomoDisableBrowserFeatureDetectionInLineHelp',
['<br><strong>', '<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/how-to/how-do-i-disable-browser-feature-detection-completely/', null, null, 'App.TagManager.getParameters') . '" target="_blank" rel="noreferrer noopener">', '</a>', '</strong>']);
}),
$this->makeSetting('domains', array(), FieldConfig::TYPE_ARRAY, function (FieldConfig $field) {
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoDomainsTitle');
Expand Down Expand Up @@ -378,7 +380,8 @@ public function getParameters()
);

$field->condition = 'forceRequestMethod';
$field->inlineHelp = Piwik::translate('TagManager_MatomoConfigurationMatomoRequestMethodInlineHelp', array('<a href="https://matomo.org/faq/how-to/faq_18694/" target="_blank" rel="noreferrer noopener">', '</a>', '<br>'));
$field->inlineHelp = Piwik::translate('TagManager_MatomoConfigurationMatomoRequestMethodInlineHelp',
['<a href="' . Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/how-to/faq_18694/') . '" target="_blank" rel="noreferrer noopener">', '</a>', '<br>']);
}),
$matomoUrl = $this->makeSetting('requestContentType', 'application/x-www-form-urlencoded; charset=UTF-8', FieldConfig::TYPE_STRING, function (FieldConfig $field) {
$field->title = Piwik::translate('TagManager_MatomoConfigurationMatomoRequestContentTypeTitle');
Expand Down
2 changes: 1 addition & 1 deletion templates/previewDebugNotification.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
<br>
{{ 'TagManager_PreviewDebugEnabledNotificationLine2'|translate('<strong>','</strong>',mtmPreviewIdUrlStart ~ '?' ~ mtmPreviewId ~ mtmPreviewIdUrlEnd, mtmPreviewIdUrlStart ~ '&' ~ mtmPreviewId ~ mtmPreviewIdUrlEnd, '<br>')|raw }}
<br>
{{ 'TagManager_PreviewDebugEnabledNotificationLine3'|translate('<a href="https://matomo.org/faq/tag-manager/why-is-debug-console-not-loading-for-me/" target="_blank" rel="noreferrer noopener">','</a>')|raw }}
{{ 'TagManager_PreviewDebugEnabledNotificationLine3'|translate(externallink('https://matomo.org/faq/tag-manager/why-is-debug-console-not-loading-for-me/'),'</a>')|raw }}
4 changes: 2 additions & 2 deletions templates/trackingCodeReact.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
{% if wasDetected %}
<div class="system notification notification-info">
{{ 'SitesManager_ReactDetected'|translate(
'<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/guide/tag-manager/">',
externallink('https://matomo.org/guide/tag-manager/'),
'</a>',
'<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/faq/new-to-piwik/how-do-i-start-tracking-data-with-matomo-on-websites-that-use-react/">',
externallink('https://matomo.org/faq/new-to-piwik/how-do-i-start-tracking-data-with-matomo-on-websites-that-use-react/'),
'</a>'
)|raw }}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/trackingSPA.twig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2>{{ 'SitesManager_StepByStepGuide'|translate }}</h2>

<p>{{ 'SitesManager_SiteWithoutDataSPADescription'|translate('<a href="https://matomo.org/guide/tag-manager/" target="_blank" rel="noreferrer noopener">', '</a>', '<a href="https://developer.matomo.org/guides/spa-tracking" target="_blank" rel="noreferrer noopener">', '</a>')|raw }}</p>
<p>{{ 'SitesManager_SiteWithoutDataSPADescription'|translate(externallink('https://matomo.org/guide/tag-manager/'), '</a>', externallink('https://developer.matomo.org/guides/spa-tracking'), '</a>')|raw }}</p>
<br>
<p>{{ 'SitesManager_SiteWithoutDataCloudflareFollowStepsIntro'|translate }}</p>
<div
Expand Down
Loading
Loading