Skip to content

Commit

Permalink
Merge pull request #465 from matomo-org/m10336-ui-links-add-campaign
Browse files Browse the repository at this point in the history
Add campaign tracking parameters for all links within Matomo app that link to matomo.org
  • Loading branch information
AltamashShaikh authored Nov 8, 2023
2 parents 3ca02d6 + 798e4b4 commit a17150f
Show file tree
Hide file tree
Showing 9 changed files with 1,348 additions and 1,928 deletions.
1 change: 0 additions & 1 deletion Google/GoogleGA4GoalMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use Piwik\Log\LoggerInterface;
class GoogleGA4GoalMapper
{
const FUNNELS_URL = 'https://plugins.matomo.org/Funnels';
/**
* @var LoggerInterface
*/
Expand Down
5 changes: 3 additions & 2 deletions Google/GoogleGoalMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
use Piwik\Plugins\GoogleAnalyticsImporter\CannotImportGoalException;
use Piwik\Plugins\SitesManager\API;
use Piwik\Log\LoggerInterface;
use Piwik\Url;
class GoogleGoalMapper
{
const FUNNELS_URL = 'https://plugins.matomo.org/Funnels';
/**
* @var LoggerInterface
*/
Expand Down Expand Up @@ -90,7 +90,8 @@ private function mapUrlDestinationGoal(array &$result, \Matomo\Dependencies\Goog
return;
}
if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated('Funnels')) {
throw new CannotImportGoalException($gaGoal, 'multiple steps in a URL destination goal found, this is only supported in Matomo through the <a href="' . self::FUNNELS_URL . '">Funnels</a> plugin');
throw new CannotImportGoalException($gaGoal, 'multiple steps in a URL destination goal found, this is only supported in Matomo through the <a href="' .
Url::addCampaignParametersToMatomoLink('https://plugins.matomo.org/Funnels') . '">Funnels</a> plugin');
}
$result['funnel'] = $this->mapFunnelSteps($gaGoal, $urlMatchDetails);
}
Expand Down
2 changes: 1 addition & 1 deletion GoogleAnalyticsImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,6 @@ public static function getConfigureConnectProps($nonce)
if ($idSite < 1) {
$idSite = StaticContainer::get(UserPreferences::class)->getDefaultWebsiteId();
}
return ['isConnectAccountsActivated' => $isConnectAccountsActivated, 'primaryText' => Piwik::translate('GoogleAnalyticsImporter_ConfigureTheImporterLabel1'), 'radioOptions' => !$isConnectAccountsActivated ? [] : ['connectAccounts' => Piwik::translate('ConnectAccounts_OptionQuickConnectWithGa'), 'manual' => Piwik::translate('ConnectAccounts_OptionAdvancedConnectWithGa')], 'googleAuthUrl' => $googleAuthUrl, 'manualConfigText' => Piwik::translate('GoogleAnalyticsImporter_ConfigureTheImporterLabel2') . '<br />' . Piwik::translate('GoogleAnalyticsImporter_ConfigureTheImporterLabel3', ['<a href="https://matomo.org/faq/general/set-up-google-analytics-import/" rel="noreferrer noopener" target="_blank">', '</a>']), 'manualConfigNonce' => $nonce, 'manualActionUrl' => Url::getCurrentUrlWithoutQueryString() . '?' . Http::buildQuery(['module' => 'GoogleAnalyticsImporter', 'action' => 'configureClient', 'idSite' => $idSite]), 'connectAccountsUrl' => $googleAuthUrl, 'connectAccountsBtnText' => Piwik::translate('ConnectAccounts_ConnectWithGoogleText'), 'additionalHelpText' => Piwik::translate('GoogleAnalyticsImporter_ConfigureTheImporterHelpNewDate', ['<strong>', '</strong>'])];
return ['isConnectAccountsActivated' => $isConnectAccountsActivated, 'primaryText' => Piwik::translate('GoogleAnalyticsImporter_ConfigureTheImporterLabel1'), 'radioOptions' => !$isConnectAccountsActivated ? [] : ['connectAccounts' => Piwik::translate('ConnectAccounts_OptionQuickConnectWithGa'), 'manual' => Piwik::translate('ConnectAccounts_OptionAdvancedConnectWithGa')], 'googleAuthUrl' => $googleAuthUrl, 'manualConfigText' => Piwik::translate('GoogleAnalyticsImporter_ConfigureTheImporterLabel2') . '<br />' . Piwik::translate('GoogleAnalyticsImporter_ConfigureTheImporterLabel3', ['<a href="'.Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/general/set-up-google-analytics-import/').'" rel="noreferrer noopener" target="_blank">', '</a>']), 'manualConfigNonce' => $nonce, 'manualActionUrl' => Url::getCurrentUrlWithoutQueryString() . '?' . Http::buildQuery(['module' => 'GoogleAnalyticsImporter', 'action' => 'configureClient', 'idSite' => $idSite]), 'connectAccountsUrl' => $googleAuthUrl, 'connectAccountsBtnText' => Piwik::translate('ConnectAccounts_ConnectWithGoogleText'), 'additionalHelpText' => Piwik::translate('GoogleAnalyticsImporter_ConfigureTheImporterHelpNewDate', ['<strong>', '</strong>'])];
}
}
2,510 changes: 607 additions & 1,903 deletions vue/dist/GoogleAnalyticsImporter.umd.js

Large diffs are not rendered by default.

729 changes: 721 additions & 8 deletions vue/dist/GoogleAnalyticsImporter.umd.min.js

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions vue/src/Configure/ConfigureConnection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
import { defineComponent } from 'vue';
import {
translate,
externalLink,
} from 'CoreHome';

export default defineComponent({
Expand Down Expand Up @@ -146,21 +147,19 @@ export default defineComponent({
},
computed: {
setupGoogleAnalyticsImportFaq() {
const url = 'https://matomo.org/faq/general/set-up-google-analytics-import/';
return translate(
'GoogleAnalyticsImporter_ConfigureTheImporterLabel3',
`<a href="${url}" rel="noreferrer noopener" target="_blank">`,
externalLink('https://matomo.org/faq/general/set-up-google-analytics-import/'),
'</a>',
);
},
isUploadButtonDisabled() {
return this.isSelectingFile || this.isUploading;
},
getAdvanceConnectStep01Text() {
const faqLink = 'https://matomo.org/faq/general/set-up-google-analytics-import/';
return this.translate(
'GoogleAnalyticsImporter_GAImportNoDataScreenStep01',
`<a href="${faqLink}" target="_blank" rel="noreferrer noopener">`,
externalLink('https://matomo.org/faq/general/set-up-google-analytics-import/'),
'</a>',
);
},
Expand All @@ -171,19 +170,18 @@ export default defineComponent({
);
},
getAdvanceConnectStep04Text() {
const faqLink = 'https://matomo.org/faq/general/running-the-google-analytics-import/';
return this.translate(
'GoogleAnalyticsImporter_GAImportNoDataScreenStep04',
`<a href="${this.indexActionUrl}" target="_blank" rel="noreferrer noopener">`,
'</a>',
`<a href="${faqLink}" target="_blank" rel="noreferrer noopener">`,
externalLink('https://matomo.org/faq/general/running-the-google-analytics-import/'),
'</a>',
);
},
getAdvanceConnectStep05Text() {
return this.translate(
'GoogleAnalyticsImporter_GAImportNoDataScreenStep05',
`<a href="${this.indexActionUrl}" target="_blank" rel="noreferrer noopener">`,
externalLink(this.indexActionUrl),
'</a>',
);
},
Expand Down
4 changes: 2 additions & 2 deletions vue/src/ImportScheduler/ImportScheduler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ import {
NotificationsStore,
AjaxHelper,
parseDate,
externalLink,
} from 'CoreHome';
import { Field } from 'CorePluginsAdmin';

Expand Down Expand Up @@ -252,10 +253,9 @@ export default defineComponent({
);
},
forceIgnoreOutOfCustomDimSlotErrorHelp() {
const url = 'https://matomo.org/docs/custom-dimensions/';
return translate(
'GoogleAnalyticsImporter_ForceCustomDimensionSlotCheckHelp',
`<a href="${url}" rel="noreferrer noopener" target="_blank">`,
externalLink('https://matomo.org/docs/custom-dimensions/'),
'</a>',
);
},
Expand Down
4 changes: 2 additions & 2 deletions vue/src/ImportScheduler/ImportSchedulerGA4.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ import {
NotificationsStore,
AjaxHelper,
parseDate,
externalLink,
} from 'CoreHome';
import { Field } from 'CorePluginsAdmin';

Expand Down Expand Up @@ -258,10 +259,9 @@ export default defineComponent({
'</b>');
},
forceIgnoreOutOfCustomDimSlotErrorHelp() {
const url = 'https://matomo.org/docs/custom-dimensions/';
return translate(
'GoogleAnalyticsImporter_ForceCustomDimensionSlotCheckHelp',
`<a href="${url}" rel="noreferrer noopener" target="_blank">`,
externalLink('https://matomo.org/docs/custom-dimensions/'),
'</a>',
);
},
Expand Down
9 changes: 7 additions & 2 deletions vue/src/ImportStatus/ImportStatusRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@

<script lang="ts">
import { defineComponent } from 'vue';
import { MatomoUrl, translate, Matomo } from 'CoreHome';
import {
MatomoUrl,
translate,
Matomo,
externalLink,
} from 'CoreHome';

export default defineComponent({
props: {
Expand Down Expand Up @@ -192,7 +197,7 @@ export default defineComponent({
errorMessageBugReportRequest() {
return translate(
'GoogleAnalyticsImporter_ErrorMessageBugReportRequest',
'<a href="https://forum.matomo.org/" rel="noreferrer noopener" target="_blank">',
externalLink('https://forum.matomo.org/'),
'</a>',
);
},
Expand Down

0 comments on commit a17150f

Please sign in to comment.