diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2022-01-13 22:48:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-13 22:48:33 +0300 |
commit | fc61b6036303944883a3403a882463d1d5a17f7c (patch) | |
tree | c03fc4bdbc75ce14ca8be50016be8ba1c4ea8b32 /plugins/CoreAdminHome | |
parent | a8a0c3671ad97436559866469d72bbe9a57161a5 (diff) |
[Vue] migrate tracking code generation controllers to Vue (#18552)
* emit/broadcast on correct scope in wrapper
* rebuild vue
* fix some issues
* couple more fixes
* fix another title issue
* rebuild vue
* do not report on ajax errors in notifications if not logged in
* migrate reporting page and model
* rebuild vue
* create sites selector model adapter
* fix siteselector vue bug, initial site is only set if there is just one site available
* rebuild vue
* migrate plugin settings directive
* remove TODO
* migrate plugin filter directive
* migrate two more plugins directives
* migrate save button
* fix a bunch of bugs
* fix another widget bug
* allow change event name between angularjs and vue
* rebuild vue
* migrate plugin form directive
* get to work
* migrate select-on-focus directive and start migrating report-export directive
* finish migrating report export directive & popover component + create reusable function to create vue app and add globals to it
* rebuild vue
* remove angularjs files and move less contents to vue dir
* migrate sparkline component
* migrate progressbar component
* migrate content intro & content table directives
* rebuild vue
* migrate piwik-ajax-form component to vue
* migrate popover handler directive to service class
* migrate dropdownbutton directive though it does not seem to be in use
* migrate show sensitive data directive
* build vue
* built vue files
* fix function signature
* fix vue warning
* fix ajax request race condition
* rebuild vue
* add new notification type "help" so the help notification is not cleared when clearing transient notifications
* fix some bugs and tests
* update screenshot
* update screenshot & fix a test
* allow using unminified jquery ui + fix bug in last fix
* fix error when enrichedheadline is used in modal
* add polyfill min.js
* remove two todos
* fix widget url logic
* update some screenshots and fix sanitization/escape issue
* update screenshots
* rebuild vue
* fix url location updating regression in MatomoUrl.updateLocation use
* submodule
* update screenshots and fix possible error in json parse
* built vue files
* Merge branch 'vue-period-selector-regression' into vue-reporting-menu
* rebuild vue
* use correct variable
* rebuild vue
* fix widget url logic
* segment parameter can be undefined now for some reason
* fix ngmodel binding in siteselector adapter (for last time hopefully)
* the original site selector only set the first site to the first site in the initial sites query if there was only one site in the entire matomo instance
* fix sitesmanager ui test failure
* fix usersettings test failure
* rebuild vue
* more siteselector tweaks.
* build CoreHome
* more siteselector tweaks.
* another siteselector issue
* update screenshots
* update screenshot and try to fix random failure
* fix some issues in widget.vue when containerid is specified
* fix couple tests
* fix several test failures
* fix string concat
* fix test failure
* extra change
* fix last change and random failure
* styling fix
* fix last fix
* real fix this time
* fix stray request
* proper fix
* update build files
* try to fix random failure
* do not submit form
* check for api errors in promise chain in ajaxhelper.ts
* force a digest after a location change
* use proper abortcontroller method instead of promise hack, have to add new polyfill + try to fix random test failure
* some UI test fixes
* fix some report export issues
* several save button fixes + make replace approximation in createAngularJsAdapter better
* fix sparkline
* apply after manual click triggering in savebutton
* css fixes and piwik-content-table was never applied by angularjs in installtion
* rebuild vue
* add names to divs so they can still be queried as they were in angularjs
* rebuild vue
* rebuild vue
* now that format_metrics checkbox works, need to check it
* small delay before processing first popover
* fix dropdown class/directive name
* fix overlay test
* remove unintended changes
* remove unintended changes
* migrate archiving controller
* do not do a passthrough transpile of vue typescript, and fix many typescript errors in existing code
* more typescript fixes
* even more fixes
* workarounds to fix recursive typing issues
* get corehome to build w/ full typescript build and output type definitions to local dir
* get outputted typings to be used when compiling other plugins and fix typescript issues in CorePluginsAdmin
* readd corehome umd
* fix typescript errors in ExampleVue plugin
* fix feedback typescript errors
* rebuild
* migrate branding controller and get to build
* fix issues and get to work
* rebuild
* fix notification scroll
* migrate smtp settings controller in coreadminhome
* get to work
* migrate js tracking code generator and get to build
* migrate image tracking code generator and get to build
* get to work in UI
* update screenshots
* Show a summary of new features (#18065)
* Added "What is new" notification display, populated by a new event
* Removed test example event hook
* Added support for applying a link attribute to menu items, fixes layout issue for mobile with html menu items
* Updated UI test screenshots
* Revert accidental edit
* Hide the "What's new" icon if there are no new features to show
* Changed to use changes.json, track user last viewed, added ui test
* Fix UserManager unit tests broken by new ts_changes_viewed user field
* Moved getChanges to separate helper class, added unit test, added user view access check
* Updated to add new changes table and populate only on plugin update/install
* Added missing fixture class, updated UI screenshots
* Updated matomo font to add ringing bell and new releases icons
* Fix for integration test
* Reworked class structure, removed unnecessary angular directive, merged templates, other tidy ups
* built vue files
* built vue files
* Added null user check, missing table exception handling, show plugin name in change title, better handling of missing change fields
* Added sample changes file, moved UserChanges db code to changes model, added return type hints, better db error code handling, various other improvements
* Revert accidental UI screenshot commit
* Fix for incorrect link name parameter in sample changes, switched back to using $db->query for INSERT IGNORE
* Integration test fix, UI screenshot updates
* Test fix
* Added link styling, show CoreHome changes without plugin prefix in title
* Update UI test screenshot
* Added styles to the popover, added event for filtering changes
* Test fix
* UI test screenshot updates
Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: bx80 <bx80@users.noreply.github.com>
* Update test translation (#18531)
update a test failed XML
* updates all submodules (#18541)
Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
* Translations update from Hosted Weblate (#18529)
* Translated using Weblate (Greek)
Currently translated at 100.0% (162 of 162 strings)
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/el/
[ci skip]
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Vasilis Lourdas <dev@lourdas.eu>
* Translated using Weblate (Chinese (Simplified))
Currently translated at 83.9% (136 of 162 strings)
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/zh_Hans/
[ci skip]
Translated using Weblate (Chinese (Simplified))
Currently translated at 99.6% (620 of 622 strings)
Translation: Matomo/Matomo Base
Translate-URL: https://hosted.weblate.org/projects/matomo/matomo-base/zh_Hans/
[ci skip]
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: 刘韬 <lyuutau@outlook.com>
* Update translation files
Updated by "Squash Git commits" hook in Weblate.
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/
[ci skip]
Co-authored-by: Vasilis Lourdas <dev@lourdas.eu>
Co-authored-by: 刘韬 <lyuutau@outlook.com>
* [Vue] migrate report export directive and popover (#18440)
* update files
* sidenav start
* make getRef a utility method
* tweak
* add return type
* finish converting side-nav directive
* starting on reporting menu conversion
* remove unused properties
* convert reporting pages service
* migrate report metadata store
* remove angularjs files
* migrating reporting pages store
* make store adapters more immutable
* get service adapters to work
* fix a UI test
* another html fix
* migrate most of reporting menu directive and model
* Use themed font family for input forms to override materialize.css styling
* rebuild vue
* add a missing div
* ui test fixes
* update styling
* get to build
* get to load in the UI w/o error
* clone result of functions
* fix compile issue
* migrate widget loader and get to load in UI
* rebuild vue
* migrate widgetcontainer
* migrate widget bydimension container
* migrate widget + add tooltips directive
* quick fix
* Updating version to 4.6.0
* loading in page
* update expected screenshot
* add wait just in case travis is slow
* fix ordering bug
* add another wait
* rebuild vue
* css tweak
* fix some bugs and tests
* undo screenshot changes
* Menus test passing locally
* [Vue] date picker viewDate property is not kept up to date (#18385)
* viewDate ref is not kept up to date
* rebuild corehome
* reporting menu subcategory items are meant to be normal links
* update some screenshots
* use innerText instead of text() since angularjs maintains newlines in HTML that vue does not add
* trigger angularjs digest after ajaxhelper request
* rebuild vue
* update screenshots, fix bug in link generation in reporting menu and allow syncing multiple screenshot regexes at a time
* undo box-shadow change for UI tests
* fix more issues & update more tests
* update some screenshots
* fix some tests
* rebuild CoreHome
* quick fix
* built vue files
* fix angularjs issue
* add comment
* update umd files
* 4.6.1-rc1
* 4.6.1
* fix field array title
* apply some pr feedback
* apply more pr feedback
* another fix
* tweak
* fix ng-change not executed before ng-model
* fix another set of issues
* fix another issue
* rebuild vue
* better ng-change/ng-model fix
* update some screenshots
* rebuild vue
* remove some TODOs
* initiate initial ng-change ONLY for site selectors where this behavior applies
* emit/broadcast on correct scope in wrapper
* rebuild vue
* fix some issues
* couple more fixes
* fix another title issue
* rebuild vue
* do not report on ajax errors in notifications if not logged in
* migrate reporting page and model
* rebuild vue
* create sites selector model adapter
* fix siteselector vue bug, initial site is only set if there is just one site available
* rebuild vue
* migrate plugin settings directive
* remove TODO
* migrate plugin filter directive
* migrate two more plugins directives
* migrate save button
* fix a bunch of bugs
* fix another widget bug
* allow change event name between angularjs and vue
* rebuild vue
* migrate plugin form directive
* get to work
* migrate select-on-focus directive and start migrating report-export directive
* finish migrating report export directive & popover component + create reusable function to create vue app and add globals to it
* rebuild vue
* remove angularjs files and move less contents to vue dir
* built vue files
* fix function signature
* fix vue warning
* fix ajax request race condition
* rebuild vue
* add new notification type "help" so the help notification is not cleared when clearing transient notifications
* fix some bugs and tests
* update screenshot
* update screenshot & fix a test
* allow using unminified jquery ui + fix bug in last fix
* fix error when enrichedheadline is used in modal
* add polyfill min.js
* remove two todos
* fix widget url logic
* update some screenshots and fix sanitization/escape issue
* update screenshots
* rebuild vue
* fix url location updating regression in MatomoUrl.updateLocation use
* submodule
* update screenshots and fix possible error in json parse
* built vue files
* Merge branch 'vue-period-selector-regression' into vue-reporting-menu
* rebuild vue
* use correct variable
* rebuild vue
* fix widget url logic
* segment parameter can be undefined now for some reason
* fix ngmodel binding in siteselector adapter (for last time hopefully)
* the original site selector only set the first site to the first site in the initial sites query if there was only one site in the entire matomo instance
* fix sitesmanager ui test failure
* fix usersettings test failure
* rebuild vue
* more siteselector tweaks.
* build CoreHome
* more siteselector tweaks.
* another siteselector issue
* update screenshots
* update screenshot and try to fix random failure
* fix some issues in widget.vue when containerid is specified
* fix couple tests
* fix several test failures
* fix string concat
* fix test failure
* extra change
* fix last change and random failure
* styling fix
* fix last fix
* real fix this time
* fix stray request
* proper fix
* update build files
* try to fix random failure
* do not submit form
* check for api errors in promise chain in ajaxhelper.ts
* force a digest after a location change
* use proper abortcontroller method instead of promise hack, have to add new polyfill + try to fix random test failure
* some UI test fixes
* fix some report export issues
* several save button fixes + make replace approximation in createAngularJsAdapter better
* apply after manual click triggering in savebutton
* add names to divs so they can still be queried as they were in angularjs
* rebuild vue
* now that format_metrics checkbox works, need to check it
* fix unintended changes
* updated expected screenshots
* update two more
* go back to previous format_metrics behavior in popover
Co-authored-by: Justin Velluppillai <justin@innocraft.com>
Co-authored-by: justinvelluppillai <justinvelluppillai@users.noreply.github.com>
Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com>
* [Vue] remove support in vue for FormField.allSettings (#18542)
* deprecate support in vue for FormField.allSettings since deep watching the property doesnt quite work
* built vue files
* update screenshots
* update screenshot
* Show a summary of new features (#18065)
* Added "What is new" notification display, populated by a new event
* Removed test example event hook
* Added support for applying a link attribute to menu items, fixes layout issue for mobile with html menu items
* Updated UI test screenshots
* Revert accidental edit
* Hide the "What's new" icon if there are no new features to show
* Changed to use changes.json, track user last viewed, added ui test
* Fix UserManager unit tests broken by new ts_changes_viewed user field
* Moved getChanges to separate helper class, added unit test, added user view access check
* Updated to add new changes table and populate only on plugin update/install
* Added missing fixture class, updated UI screenshots
* Updated matomo font to add ringing bell and new releases icons
* Fix for integration test
* Reworked class structure, removed unnecessary angular directive, merged templates, other tidy ups
* built vue files
* built vue files
* Added null user check, missing table exception handling, show plugin name in change title, better handling of missing change fields
* Added sample changes file, moved UserChanges db code to changes model, added return type hints, better db error code handling, various other improvements
* Revert accidental UI screenshot commit
* Fix for incorrect link name parameter in sample changes, switched back to using $db->query for INSERT IGNORE
* Integration test fix, UI screenshot updates
* Test fix
* Added link styling, show CoreHome changes without plugin prefix in title
* Update UI test screenshot
* Added styles to the popover, added event for filtering changes
* Test fix
* UI test screenshot updates
Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: bx80 <bx80@users.noreply.github.com>
* Update test translation (#18531)
update a test failed XML
* updates all submodules (#18541)
Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
* Translations update from Hosted Weblate (#18529)
* Translated using Weblate (Greek)
Currently translated at 100.0% (162 of 162 strings)
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/el/
[ci skip]
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Vasilis Lourdas <dev@lourdas.eu>
* Translated using Weblate (Chinese (Simplified))
Currently translated at 83.9% (136 of 162 strings)
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/zh_Hans/
[ci skip]
Translated using Weblate (Chinese (Simplified))
Currently translated at 99.6% (620 of 622 strings)
Translation: Matomo/Matomo Base
Translate-URL: https://hosted.weblate.org/projects/matomo/matomo-base/zh_Hans/
[ci skip]
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: 刘韬 <lyuutau@outlook.com>
* Update translation files
Updated by "Squash Git commits" hook in Weblate.
Translation: Matomo/Plugin CoreAdminHome
Translate-URL: https://hosted.weblate.org/projects/matomo/plugin-coreadminhome/
[ci skip]
Co-authored-by: Vasilis Lourdas <dev@lourdas.eu>
Co-authored-by: 刘韬 <lyuutau@outlook.com>
* [Vue] migrate report export directive and popover (#18440)
* update files
* sidenav start
* make getRef a utility method
* tweak
* add return type
* finish converting side-nav directive
* starting on reporting menu conversion
* remove unused properties
* convert reporting pages service
* migrate report metadata store
* remove angularjs files
* migrating reporting pages store
* make store adapters more immutable
* get service adapters to work
* fix a UI test
* another html fix
* migrate most of reporting menu directive and model
* Use themed font family for input forms to override materialize.css styling
* rebuild vue
* add a missing div
* ui test fixes
* update styling
* get to build
* get to load in the UI w/o error
* clone result of functions
* fix compile issue
* migrate widget loader and get to load in UI
* rebuild vue
* migrate widgetcontainer
* migrate widget bydimension container
* migrate widget + add tooltips directive
* quick fix
* Updating version to 4.6.0
* loading in page
* update expected screenshot
* add wait just in case travis is slow
* fix ordering bug
* add another wait
* rebuild vue
* css tweak
* fix some bugs and tests
* undo screenshot changes
* Menus test passing locally
* [Vue] date picker viewDate property is not kept up to date (#18385)
* viewDate ref is not kept up to date
* rebuild corehome
* reporting menu subcategory items are meant to be normal links
* update some screenshots
* use innerText instead of text() since angularjs maintains newlines in HTML that vue does not add
* trigger angularjs digest after ajaxhelper request
* rebuild vue
* update screenshots, fix bug in link generation in reporting menu and allow syncing multiple screenshot regexes at a time
* undo box-shadow change for UI tests
* fix more issues & update more tests
* update some screenshots
* fix some tests
* rebuild CoreHome
* quick fix
* built vue files
* fix angularjs issue
* add comment
* update umd files
* 4.6.1-rc1
* 4.6.1
* fix field array title
* apply some pr feedback
* apply more pr feedback
* another fix
* tweak
* fix ng-change not executed before ng-model
* fix another set of issues
* fix another issue
* rebuild vue
* better ng-change/ng-model fix
* update some screenshots
* rebuild vue
* remove some TODOs
* initiate initial ng-change ONLY for site selectors where this behavior applies
* emit/broadcast on correct scope in wrapper
* rebuild vue
* fix some issues
* couple more fixes
* fix another title issue
* rebuild vue
* do not report on ajax errors in notifications if not logged in
* migrate reporting page and model
* rebuild vue
* create sites selector model adapter
* fix siteselector vue bug, initial site is only set if there is just one site available
* rebuild vue
* migrate plugin settings directive
* remove TODO
* migrate plugin filter directive
* migrate two more plugins directives
* migrate save button
* fix a bunch of bugs
* fix another widget bug
* allow change event name between angularjs and vue
* rebuild vue
* migrate plugin form directive
* get to work
* migrate select-on-focus directive and start migrating report-export directive
* finish migrating report export directive & popover component + create reusable function to create vue app and add globals to it
* rebuild vue
* remove angularjs files and move less contents to vue dir
* built vue files
* fix function signature
* fix vue warning
* fix ajax request race condition
* rebuild vue
* add new notification type "help" so the help notification is not cleared when clearing transient notifications
* fix some bugs and tests
* update screenshot
* update screenshot & fix a test
* allow using unminified jquery ui + fix bug in last fix
* fix error when enrichedheadline is used in modal
* add polyfill min.js
* remove two todos
* fix widget url logic
* update some screenshots and fix sanitization/escape issue
* update screenshots
* rebuild vue
* fix url location updating regression in MatomoUrl.updateLocation use
* submodule
* update screenshots and fix possible error in json parse
* built vue files
* Merge branch 'vue-period-selector-regression' into vue-reporting-menu
* rebuild vue
* use correct variable
* rebuild vue
* fix widget url logic
* segment parameter can be undefined now for some reason
* fix ngmodel binding in siteselector adapter (for last time hopefully)
* the original site selector only set the first site to the first site in the initial sites query if there was only one site in the entire matomo instance
* fix sitesmanager ui test failure
* fix usersettings test failure
* rebuild vue
* more siteselector tweaks.
* build CoreHome
* more siteselector tweaks.
* another siteselector issue
* update screenshots
* update screenshot and try to fix random failure
* fix some issues in widget.vue when containerid is specified
* fix couple tests
* fix several test failures
* fix string concat
* fix test failure
* extra change
* fix last change and random failure
* styling fix
* fix last fix
* real fix this time
* fix stray request
* proper fix
* update build files
* try to fix random failure
* do not submit form
* check for api errors in promise chain in ajaxhelper.ts
* force a digest after a location change
* use proper abortcontroller method instead of promise hack, have to add new polyfill + try to fix random test failure
* some UI test fixes
* fix some report export issues
* several save button fixes + make replace approximation in createAngularJsAdapter better
* apply after manual click triggering in savebutton
* add names to divs so they can still be queried as they were in angularjs
* rebuild vue
* now that format_metrics checkbox works, need to check it
* fix unintended changes
* updated expected screenshots
* update two more
* go back to previous format_metrics behavior in popover
Co-authored-by: Justin Velluppillai <justin@innocraft.com>
Co-authored-by: justinvelluppillai <justinvelluppillai@users.noreply.github.com>
Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com>
* [Vue] remove support in vue for FormField.allSettings (#18542)
* deprecate support in vue for FormField.allSettings since deep watching the property doesnt quite work
* built vue files
* update screenshots
* update screenshot
* fix tests
* rebuild
* rebuild
* order plugins by dependencies in vue:build and fix warning in corehome build
* built vue files
* built vue files
* remove unused imports
* fix bug and rebuild
* fix bug and rebuild
* fix issue
* fix issues and rebuild
* fix ui test
* apply pr fixes
* Update plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.vue
* built vue files
* improve code
* couple more fixes
* update screenshot, remove debug code
Co-authored-by: Ben Burgess <88810029+bx80@users.noreply.github.com>
Co-authored-by: sgiehl <stefan@matomo.org>
Co-authored-by: bx80 <bx80@users.noreply.github.com>
Co-authored-by: Peter Zhang <peter@innocraft.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Weblate (bot) <hosted@weblate.org>
Co-authored-by: Vasilis Lourdas <dev@lourdas.eu>
Co-authored-by: 刘韬 <lyuutau@outlook.com>
Co-authored-by: Justin Velluppillai <justin@innocraft.com>
Co-authored-by: justinvelluppillai <justinvelluppillai@users.noreply.github.com>
Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com>
Co-authored-by: sgiehl <sgiehl@users.noreply.github.com>
Diffstat (limited to 'plugins/CoreAdminHome')
12 files changed, 2097 insertions, 648 deletions
diff --git a/plugins/CoreAdminHome/Controller.php b/plugins/CoreAdminHome/Controller.php index a8737f7d6d..20283d6d4c 100644 --- a/plugins/CoreAdminHome/Controller.php +++ b/plugins/CoreAdminHome/Controller.php @@ -232,6 +232,10 @@ class Controller extends ControllerAdmin } $view->defaultSite = array('id' => $view->idSite, 'name' => $view->defaultReportSiteName); + $view->defaultSiteDecoded = [ + 'id' => $view->idSite, + 'name' => Common::unsanitizeInputValue($view->defaultReportSiteName), + ]; $allUrls = APISitesManager::getInstance()->getSiteUrlsFromId($view->idSite); if (isset($allUrls[1])) { diff --git a/plugins/CoreAdminHome/CoreAdminHome.php b/plugins/CoreAdminHome/CoreAdminHome.php index 5c06f5bccb..f542798d6e 100644 --- a/plugins/CoreAdminHome/CoreAdminHome.php +++ b/plugins/CoreAdminHome/CoreAdminHome.php @@ -161,5 +161,49 @@ class CoreAdminHome extends \Piwik\Plugin $translationKeys[] = 'General_EncryptedSmtpTransport'; $translationKeys[] = 'General_OnlyEnterIfRequiredPassword'; $translationKeys[] = 'General_WarningPasswordStored'; + $translationKeys[] = 'CoreAdminHome_ImageTracking'; + $translationKeys[] = 'CoreAdminHome_TrackAGoal'; + $translationKeys[] = 'CoreAdminHome_WithOptionalRevenue'; + $translationKeys[] = 'CoreAdminHome_ImageTrackingLink'; + $translationKeys[] = 'CoreAdminHome_ImageTrackingIntro1'; + $translationKeys[] = 'CoreAdminHome_ImageTrackingIntro2'; + $translationKeys[] = 'CoreAdminHome_ImageTrackingIntro3'; + $translationKeys[] = 'CoreAdminHome_JavaScriptTracking'; + $translationKeys[] = 'CoreAdminHome_JSTrackingIntro1'; + $translationKeys[] = 'CoreAdminHome_JSTrackingIntro2'; + $translationKeys[] = 'CoreAdminHome_JSTrackingIntro3b'; + $translationKeys[] = 'General_JsTrackingTag'; + $translationKeys[] = 'SitesManager_EmailInstructionsButton'; + $translationKeys[] = 'CoreAdminHome_JSTracking_MergeSubdomains'; + $translationKeys[] = 'CoreAdminHome_JSTracking_GroupPageTitlesByDomainDesc1'; + $translationKeys[] = 'CoreAdminHome_JSTracking_GroupPageTitlesByDomain'; + $translationKeys[] = 'CoreAdminHome_JSTracking_MergeAliasesDesc'; + $translationKeys[] = 'CoreAdminHome_JSTracking_MergeAliases'; + $translationKeys[] = 'CoreAdminHome_JSTracking_TrackNoScript'; + $translationKeys[] = 'Mobile_Advanced'; + $translationKeys[] = 'CoreAdminHome_JSTracking_VisitorCustomVars'; + $translationKeys[] = 'CoreAdminHome_JSTracking_VisitorCustomVarsDesc'; + $translationKeys[] = 'CoreAdminHome_JSTracking_CrossDomain'; + $translationKeys[] = 'CoreAdminHome_JSTracking_CrossDomain_NeedsMultipleDomains'; + $translationKeys[] = 'CoreAdminHome_JSTracking_EnableCrossDomainLinking'; + $translationKeys[] = 'CoreAdminHome_JSTracking_EnableDoNotTrackDesc'; + $translationKeys[] = 'CoreAdminHome_JSTracking_EnableDoNotTrack_AlreadyEnabled'; + $translationKeys[] = 'CoreAdminHome_JSTracking_EnableDoNotTrack'; + $translationKeys[] = 'CoreAdminHome_JSTracking_DisableCookies'; + $translationKeys[] = 'CoreAdminHome_JSTracking_DisableCookiesDesc'; + $translationKeys[] = 'CoreAdminHome_JSTracking_CustomCampaignQueryParam'; + $translationKeys[] = 'CoreAdminHome_JSTracking_CampaignNameParam'; + $translationKeys[] = 'CoreAdminHome_JSTracking_CampaignKwdParam'; + $translationKeys[] = 'SitesManager_EmailInstructionsSubject'; + $translationKeys[] = 'SitesManager_JsTrackingTagHelp'; + $translationKeys[] = 'CoreAdminHome_JSTracking_CodeNoteBeforeClosingHeadEmail'; + $translationKeys[] = 'CoreAdminHome_JSTrackingIntro3a'; + $translationKeys[] = 'CoreAdminHome_JSTrackingIntro4'; + $translationKeys[] = 'CoreAdminHome_JSTrackingIntro5'; + $translationKeys[] = 'General_Options'; + $translationKeys[] = 'General_Value'; + $translationKeys[] = 'Actions_ColumnPageName'; + $translationKeys[] = 'CoreAdminHome_JSTracking_MergeSubdomainsDesc'; + $translationKeys[] = 'CoreAdminHome_JSTracking_CustomCampaignQueryParamDesc'; } } diff --git a/plugins/CoreAdminHome/angularjs/trackingcode/imagetrackingcode.controller.js b/plugins/CoreAdminHome/angularjs/trackingcode/imagetrackingcode.controller.js deleted file mode 100644 index 4f826add41..0000000000 --- a/plugins/CoreAdminHome/angularjs/trackingcode/imagetrackingcode.controller.js +++ /dev/null @@ -1,131 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * @link https://matomo.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -/** - * Controller for image tracking code generator - */ -(function () { - - // cache for not refetching data for same site twice - var sitePromises = {}, goalPromises = {}; - - angular.module('piwikApp').controller('ImageTrackingCodeController', ImageTrackingCodeController); - - ImageTrackingCodeController.$inject = ['piwikApi', '$q']; - - function ImageTrackingCodeController(piwikApi, $q) { - - this.allGoals = {}; - this.isLoading = false; - - var piwikHost = window.location.host, - piwikPath = location.pathname.substring(0, location.pathname.lastIndexOf('/')), - self = this; - - var currencyPromise = piwikApi.fetch({method: 'SitesManager.getCurrencySymbols', filter_limit: '-1'}); - - function requestSiteData(idSite) - { - if (!sitePromises[idSite]) { - sitePromises[idSite] = piwikApi.fetch({ - module: 'API', - method: 'SitesManager.getSiteFromId', - idSite: idSite - }); - } - - return sitePromises[idSite]; - } - - function requestGoalData(idSite) - { - if (!goalPromises[idSite]) { - goalPromises[idSite] = piwikApi.fetch({ - module: 'API', - method: 'Goals.getGoals', - filter_limit: '-1', - idSite: idSite - }); - } - - return goalPromises[idSite]; - } - - // function that generates image tracker link - var generateImageTrackingAjax = null, - generateImageTrackerLink = function (trackingCodeChangedManually) { - // get data used to generate the link - var postParams = { - piwikUrl: piwikHost + piwikPath, - actionName: self.pageName, - forceMatomoEndpoint: 1 - }; - - if (self.trackGoal && self.trackIdGoal) { - postParams.idGoal = self.trackIdGoal; - postParams.revenue = self.revenue; - } - - if (generateImageTrackingAjax) { - generateImageTrackingAjax.abort(); - } - - generateImageTrackingAjax = piwikApi.post({ - module: 'API', - format: 'json', - method: 'SitesManager.getImageTrackingCode', - idSite: self.site.id - }, postParams).then(function (response) { - generateImageTrackingAjax = null; - - self.trackingCode = response.value; - - if (trackingCodeChangedManually) { - var jsCodeTextarea = $('#image-tracking-text .codeblock'); - jsCodeTextarea.effect("highlight", {}, 1500); - } - }); - }; - - this.updateTrackingCode = function () { - generateImageTrackerLink(true); - }; - - this.changeSite = function (changedManually) { - - self.isLoading = true; - - var sitePromise = requestSiteData(this.site.id); - var goalPromise = requestGoalData(this.site.id); - - return $q.all([currencyPromise, sitePromise, goalPromise]).then(function (data) { - - self.isLoading = false; - - var currencySymbols = data[0] || {}; - var currency = data[1].currency || ''; - var goals = data[2] || []; - - var goalsList = [{key: '', value: _pk_translate('UserCountryMap_None')}]; - for (var key in goals) { - goalsList.push({key: goals[key].idgoal, value: goals[key].name}); - } - - self.allGoals = goalsList; - - $('[name=image-revenue] .site-currency').text(currencySymbols[currency.toUpperCase()]); - generateImageTrackerLink(changedManually); - - }); - }; - - if (this.site && this.site.id) { - this.changeSite(false); - } - - } -})();
\ No newline at end of file diff --git a/plugins/CoreAdminHome/angularjs/trackingcode/jstrackingcode.controller.js b/plugins/CoreAdminHome/angularjs/trackingcode/jstrackingcode.controller.js deleted file mode 100644 index 5d272a51e5..0000000000 --- a/plugins/CoreAdminHome/angularjs/trackingcode/jstrackingcode.controller.js +++ /dev/null @@ -1,194 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * @link https://matomo.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -/** - * Controller for javascript tracking code generator - */ -(function () { - - // gets the list of custom variables entered by the user in a custom variable section - function getCustomVariables(customVars) { - var result = []; - angular.forEach(customVars, function (customVar) { - result.push([customVar.name, customVar.value]); - }); - return result; - } - - // quickly gets the host + port from a url - function getHostNameFromUrl(url) { - var element = $('<a></a>')[0]; - element.href = url; - return element.hostname; - } - - angular.module('piwikApp').controller('JsTrackingCodeController', JsTrackingCodeController); - - JsTrackingCodeController.$inject = ['$scope', '$filter', 'piwikApi']; - - function JsTrackingCodeController($scope, $filter, piwikApi) { - - var translate = $filter('translate'); - - this.showAdvanced = false; - this.isLoading = false; - this.customVars = []; - this.siteUrls = {}; - this.siteExcludedQueryParams = {}; - this.hasManySiteUrls = false; - this.maxCustomVariables = parseInt(angular.element('[name=numMaxCustomVariables]').val(), 10); - this.canAddMoreCustomVariables = this.maxCustomVariables && this.maxCustomVariables > 0; - - // get preloaded server-side data necessary for code generation - var piwikHost = window.location.host, - piwikPath = location.pathname.substring(0, location.pathname.lastIndexOf('/')), - self = this; - - // queries Piwik for needed site info for one site - var getSiteData = function (idSite, sectionSelect, callback) { - // if data is already loaded, don't do an AJAX request - if (self.siteUrls[idSite] && self.siteExcludedQueryParams[idSite]) { - - callback(); - return; - } - - // disable section - self.isLoading = true; - - piwikApi.fetch({ - module: 'API', - method: 'SitesManager.getSiteUrlsFromId', - idSite: idSite, - filter_limit: '-1' - }).then(function (data) { - self.siteUrls[idSite] = data || []; - // Load site excludedQueryParams - piwikApi.fetch({ - module: 'API', - method: 'Overlay.getExcludedQueryParameters', - idSite: idSite, - filter_limit: '-1' - }).then(function (data) { - self.siteExcludedQueryParams[idSite] = data || []; - self.isLoading = false; - callback(); - }); - }); - - }; - - - // function that generates JS code - var generateJsCodeAjax = null; - var generateJsCode = function (trackingCodeChangedManually) { - // get params used to generate JS code - var params = { - piwikUrl: piwikHost + piwikPath, - groupPageTitlesByDomain: self.groupByDomain ? 1 : 0, - mergeSubdomains: self.trackAllSubdomains ? 1 : 0, - mergeAliasUrls: self.trackAllAliases ? 1 : 0, - visitorCustomVariables: self.trackCustomVars ? getCustomVariables(self.customVars) : 0, - customCampaignNameQueryParam: null, - customCampaignKeywordParam: null, - doNotTrack: self.doNotTrack ? 1 : 0, - disableCookies: self.disableCookies ? 1 : 0, - crossDomain: self.crossDomain ? 1 : 0, - trackNoScript: self.trackNoScript ? 1: 0, - forceMatomoEndpoint: 1 - }; - - if (self.siteExcludedQueryParams[self.site.id]) { - params.excludedQueryParams = self.siteExcludedQueryParams[self.site.id]; - } - - if (self.useCustomCampaignParams) { - params.customCampaignNameQueryParam = self.customCampaignName; - params.customCampaignKeywordParam = self.customCampaignKeyword; - } - - if (generateJsCodeAjax) { - generateJsCodeAjax.abort(); - } - - generateJsCodeAjax = piwikApi.post({ - module: 'API', - format: 'json', - method: 'SitesManager.getJavascriptTag', - idSite: self.site.id - }, params).then(function (response) { - generateJsCodeAjax = null; - - self.trackingCode = response.value; - - if(trackingCodeChangedManually) { - var jsCodeTextarea = $('#javascript-text .codeblock'); - jsCodeTextarea.effect("highlight", {}, 1500); - } - }); - - return generateJsCodeAjax; - }; - - this.onCrossDomainToggle = function () { - if (this.crossDomain) { - this.trackAllAliases = true; - } - }; - - this.addCustomVar = function () { - if (this.canAddMoreCustomVariables) { - this.customVars.push({name: '', value: ''}); - } - - this.canAddMoreCustomVariables = this.maxCustomVariables > this.customVars.length; - }; - - this.addCustomVar(); - - this.updateTrackingCode = function () { - generateJsCode(true); - }; - - this.sendEmail = function() { - var subjectLine = translate('SitesManager_EmailInstructionsSubject'); - - var trackingCode = self.trackingCode; - trackingCode = trackingCode.replace(/<[^>]+>/g, ''); - var bodyText = translate('SitesManager_JsTrackingTagHelp') + '. ' - + translate('CoreAdminHome_JSTracking_CodeNoteBeforeClosingHeadEmail', "'head") - + "\n" + trackingCode; - - var linkText = 'mailto:?subject=' + encodeURIComponent(subjectLine) + '&body=' + encodeURIComponent(bodyText); - window.location.href = linkText; - }; - - this.changeSite = function (trackingCodeChangedManually) { - getSiteData(this.site.id, '#js-code-options', function () { - $('.current-site-name').text(self.site.name); - - self.hasManySiteUrls = self.siteUrls[self.site.id] && self.siteUrls[self.site.id].length > 1; - - if (!self.hasManySiteUrls) { - self.crossDomain = false; // we make sure to disable cross domain if it has only one url or less - } - - var siteHost = getHostNameFromUrl(self.siteUrls[self.site.id][0]); - $('.current-site-host').text(siteHost); - - var defaultAliasUrl = 'x.' + siteHost; - $('.current-site-alias').text(self.siteUrls[self.site.id][1] || defaultAliasUrl); - - generateJsCode(true); - }); - }; - - if (this.site && this.site.id) { - this.changeSite(false); - } - } -})(); diff --git a/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig b/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig index 99795c26ab..30555f6ce2 100644 --- a/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig +++ b/plugins/CoreAdminHome/templates/trackingCodeGenerator.twig @@ -30,325 +30,17 @@ <input type="hidden" name="numMaxCustomVariables" value="{{ maxCustomVariables|e('html_attr') }}"> -<div piwik-content-block - anchor="javaScriptTracking" - content-title="{{ 'CoreAdminHome_JavaScriptTracking'|translate|e('html_attr') }}"> - - <div id="js-code-options" ng-controller="JsTrackingCodeController as jsTrackingCode"> - - <p> - {{ 'CoreAdminHome_JSTrackingIntro1'|translate }} - <br/><br/> - {{ 'CoreAdminHome_JSTrackingIntro2'|translate }} {{ 'CoreAdminHome_JSTrackingIntro3a'|translate('<a href="https://matomo.org/integrate/" rel="noreferrer noopener" target="_blank">','</a>')|raw }} {{ 'CoreAdminHome_JSTrackingIntro3b'|translate|raw }} - <br/><br/> - {{ 'CoreAdminHome_JSTrackingIntro4'|translate('<a href="#image-tracking-link">','</a>')|raw }} - <br/><br/> - {{ 'CoreAdminHome_JSTrackingIntro5'|translate('<a rel="noreferrer noopener" target="_blank" href="https://developer.matomo.org/guides/tracking-javascript-guide">','</a>')|raw }} - <br><br/> - {{ 'SitesManager_InstallationGuides'|translate }} : - <a href="https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-wordpress/" target="_blank" rel="noopener">WordPress</a> | - <a href="https://matomo.org/faq/new-to-piwik/how-do-i-integrate-matomo-with-squarespace-website/" taret="_blank" rel="noopener">Squarespace</a> | - <a href="https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-analytics-tracking-code-on-wix/" target="_blank" rel="noopener">Wix</a> | - <a href="https://matomo.org/faq/how-to-install/faq_19424/" target="_blank" rel="noopener">SharePoint</a> | - <a href="https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-analytics-tracking-code-on-joomla/" target="_blank" rel="noopener">Joomla</a> | - <a href="https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-my-shopify-store/" target="_blank" rel="noopener">Shopify</a> | - <a href="https://matomo.org/faq/new-to-piwik/how-do-i-use-matomo-analytics-within-gtm-google-tag-manager/" target="_blank" rel="noopener">Google Tag Manager</a> - </p> - - <div piwik-field uicontrol="site" name="js-tracker-website" - class="jsTrackingCodeWebsite" - ng-model="jsTrackingCode.site" - ng-change="jsTrackingCode.changeSite(true)" - introduction="{{ 'General_Website'|translate|e('html_attr') }}" - value='{{ defaultSite|json_encode }}'> - </div> - <div id="javascript-output-section"> - <div class="valign-wrapper trackingHelpHeader matchWidth"> - <div> - <h3>{{ 'General_JsTrackingTag'|translate }}</h3> - - <p>{{ 'CoreAdminHome_JSTracking_CodeNoteBeforeClosingHead'|translate("</head>")|raw }}</p> - </div> - - <button class="btn" id="emailJsBtn" ng-click="jsTrackingCode.sendEmail()"> - {{ 'SitesManager_EmailInstructionsButton'|translate }} - </button> - </div> - <div id="javascript-text"> - <pre piwik-select-on-focus class="codeblock" - ng-bind="jsTrackingCode.trackingCode"> </pre> - </div> - - </div> - - <div id="optional-js-tracking-options"> - - {# track across all subdomains #} - <div id="jsTrackAllSubdomainsInlineHelp" class="inline-help-node"> - {{ 'CoreAdminHome_JSTracking_MergeSubdomainsDesc'|translate("x.<span class='current-site-host'></span>","y.<span class='current-site-host'></span>")|raw }} - {{ 'General_LearnMore'|translate(' (<a href="https://developer.matomo.org/guides/tracking-javascript-guide#measuring-domains-andor-sub-domains" rel="noreferrer noopener" target="_blank">', '</a>)')|raw }} - </div> - - <div piwik-field uicontrol="checkbox" name="javascript-tracking-all-subdomains" - ng-model="jsTrackingCode.trackAllSubdomains" - ng-change="jsTrackingCode.updateTrackingCode()" - data-disabled="jsTrackingCode.isLoading" - introduction="{{ 'General_Options'|translate|e('html_attr') }}" - data-title="{{ ('CoreAdminHome_JSTracking_MergeSubdomains'|translate ~ " <span class='current-site-name'></span>")|e('html_attr') }}" - value="" inline-help="#jsTrackAllSubdomainsInlineHelp"> - </div> - - {# group page titles by site domain #} - <div id="jsTrackGroupByDomainInlineHelp" class="inline-help-node"> - {{ 'CoreAdminHome_JSTracking_GroupPageTitlesByDomainDesc1'|translate("<span class='current-site-host'></span>")|raw }} - </div> - - <div piwik-field uicontrol="checkbox" name="javascript-tracking-group-by-domain" - ng-model="jsTrackingCode.groupByDomain" - ng-change="jsTrackingCode.updateTrackingCode()" - data-disabled="jsTrackingCode.isLoading" - data-title="{{ 'CoreAdminHome_JSTracking_GroupPageTitlesByDomain'|translate|e('html_attr') }}" - value="" inline-help="#jsTrackGroupByDomainInlineHelp"> - </div> - - {# track across all site aliases #} - <div id="jsTrackAllAliasesInlineHelp" class="inline-help-node"> - {{ 'CoreAdminHome_JSTracking_MergeAliasesDesc'|translate("<span class='current-site-alias'></span>")|raw }} - </div> - - <div piwik-field uicontrol="checkbox" name="javascript-tracking-all-aliases" - ng-model="jsTrackingCode.trackAllAliases" - ng-change="jsTrackingCode.updateTrackingCode()" - data-disabled="jsTrackingCode.isLoading" - data-title="{{ ('CoreAdminHome_JSTracking_MergeAliases'|translate ~ " <span class='current-site-name'></span>")|e('html_attr') }}" - value="" inline-help="#jsTrackAllAliasesInlineHelp"> - </div> - - <div piwik-field uicontrol="checkbox" name="javascript-tracking-noscript" - ng-model="jsTrackingCode.trackNoScript" - ng-change="jsTrackingCode.updateTrackingCode()" - data-disabled="jsTrackingCode.isLoading" - data-title="{{ 'CoreAdminHome_JSTracking_TrackNoScript'|translate|e('html_attr') }}" - value="" inline-help=""> - </div> - - <h3>{{ 'Mobile_Advanced'|translate }}</h3> - - <p> - <a href="javascript:;" - ng-show="!jsTrackingCode.showAdvanced" - ng-click="jsTrackingCode.showAdvanced = true">{{ 'General_Show'|translate }}</a> - <a href="javascript:;" - ng-show="jsTrackingCode.showAdvanced" - ng-click="jsTrackingCode.showAdvanced = false">{{ 'General_Hide'|translate }}</a> - </p> - - <div id="javascript-advanced-options" ng-show="jsTrackingCode.showAdvanced"> - - {# visitor custom variable #} - <div piwik-field uicontrol="checkbox" name="javascript-tracking-visitor-cv-check" - ng-model="jsTrackingCode.trackCustomVars" - ng-change="jsTrackingCode.updateTrackingCode()" - data-disabled="jsTrackingCode.isLoading" - data-title="{{ 'CoreAdminHome_JSTracking_VisitorCustomVars'|translate|e('html_attr') }}" - value="" inline-help="{{ 'CoreAdminHome_JSTracking_VisitorCustomVarsDesc'|translate|e('html_attr') }}"> - </div> - - <div id="javascript-tracking-visitor-cv" ng-show="jsTrackingCode.trackCustomVars"> - <div class="row"> - <div class="col s12 m3"> - {{ 'General_Name'|translate }} - </div> - <div class="col s12 m3"> - {{ 'General_Value'|translate }} - </div> - </div> - <div class="row" ng-repeat="customVar in jsTrackingCode.customVars"> - <div class="col s12 m6 l3"> - <input type="text" class="custom-variable-name" - ng-change="jsTrackingCode.updateTrackingCode()" - ng-model="jsTrackingCode.customVars[$index.toString()].name" - placeholder="e.g. Type"/> - </div> - <div class="col s12 m6 l3"> - <input type="text" class="custom-variable-value" - ng-change="jsTrackingCode.updateTrackingCode()" - ng-model="jsTrackingCode.customVars[$index.toString()].value" - placeholder="e.g. Customer"/> - </div> - </div> - <div class="row" ng-show="jsTrackingCode.canAddMoreCustomVariables"> - <div class="col s12"> - <a href="javascript:;" - ng-click="jsTrackingCode.addCustomVar()" - class="add-custom-variable"><span class="icon-add"></span> {{ 'General_Add'|translate }}</a> - </div> - </div> - </div> - - {# cross domain support #} - <div id="jsCrossDomain" class="inline-help-node"> - {{ "CoreAdminHome_JSTracking_CrossDomain"|translate }} - <br/> - {{ 'CoreAdminHome_JSTracking_CrossDomain_NeedsMultipleDomains'|translate }} - </div> - - <div piwik-field uicontrol="checkbox" name="javascript-tracking-cross-domain" - ng-model="jsTrackingCode.crossDomain" - ng-change="jsTrackingCode.updateTrackingCode();jsTrackingCode.onCrossDomainToggle();" - data-disabled="jsTrackingCode.isLoading || !jsTrackingCode.hasManySiteUrls" - data-title="{{ 'CoreAdminHome_JSTracking_EnableCrossDomainLinking'|translate|e('html_attr') }}" - value="" inline-help="#jsCrossDomain"> - </div> - - {# do not track support #} - <div id="jsDoNotTrackInlineHelp" class="inline-help-node"> - {{ 'CoreAdminHome_JSTracking_EnableDoNotTrackDesc'|translate }} - {% if serverSideDoNotTrackEnabled %} - <br/> - {{ 'CoreAdminHome_JSTracking_EnableDoNotTrack_AlreadyEnabled'|translate }} - {% endif %} - </div> - - <div piwik-field uicontrol="checkbox" name="javascript-tracking-do-not-track" - ng-model="jsTrackingCode.doNotTrack" - ng-change="jsTrackingCode.updateTrackingCode() " - data-disabled="jsTrackingCode.isLoading" - data-title="{{ 'CoreAdminHome_JSTracking_EnableDoNotTrack'|translate|e('html_attr') }}" - value="" inline-help="#jsDoNotTrackInlineHelp"> - </div> - - {# disable all cookies options #} - <div piwik-field uicontrol="checkbox" name="javascript-tracking-disable-cookies" - ng-model="jsTrackingCode.disableCookies" - data-disabled="jsTrackingCode.isLoading" - ng-change="jsTrackingCode.updateTrackingCode()" - data-title="{{ 'CoreAdminHome_JSTracking_DisableCookies'|translate|e('html_attr') }}" - value="" inline-help="{{ 'CoreAdminHome_JSTracking_DisableCookiesDesc'|translate|e('html_attr') }}"> - </div> - - {# custom campaign name/keyword query params #} - <div id="jsTrackCampaignParamsInlineHelp" class="inline-help-node"> - {{ 'CoreAdminHome_JSTracking_CustomCampaignQueryParamDesc'|translate('<a href="https://matomo.org/faq/general/#faq_119" rel="noreferrer noopener" target="_blank">','</a>')|raw }} - </div> - - <div piwik-field uicontrol="checkbox" name="custom-campaign-query-params-check" - ng-model="jsTrackingCode.useCustomCampaignParams" - data-disabled="jsTrackingCode.isLoading" - ng-change="jsTrackingCode.updateTrackingCode()" - data-title="{{ 'CoreAdminHome_JSTracking_CustomCampaignQueryParam'|translate|e('html_attr') }}" - value="" inline-help="#jsTrackCampaignParamsInlineHelp"> - </div> - - <div ng-show="jsTrackingCode.useCustomCampaignParams" id="js-campaign-query-param-extra"> - <div class="row"> - <div class="col s12"> - <div piwik-field uicontrol="text" name="custom-campaign-name-query-param" - ng-model="jsTrackingCode.customCampaignName" - ng-change="jsTrackingCode.updateTrackingCode()" - data-disabled="jsTrackingCode.isLoading" - data-title="{{ 'CoreAdminHome_JSTracking_CampaignNameParam'|translate|e('html_attr') }}" - value=""> - </div> - </div> - </div> - <div class="row"> - <div class="col s12"> - <div piwik-field uicontrol="text" name="custom-campaign-keyword-query-param" - ng-model="jsTrackingCode.customCampaignKeyword" - ng-change="jsTrackingCode.updateTrackingCode()" - data-disabled="jsTrackingCode.isLoading" - data-title="{{ 'CoreAdminHome_JSTracking_CampaignKwdParam'|translate|e('html_attr') }}" - value=""> - </div> - </div> - </div> - </div> - - </div> - - </div> - - - </div> -</div> - -<div piwik-content-block content-title="{{ 'CoreAdminHome_ImageTracking'|translate|e('html_attr') }}" - anchor="imageTracking"> - <a name="image-tracking-link"></a> - - <div id="image-tracking-code-options" ng-controller="ImageTrackingCodeController as imageTrackingCode"> - - <p> - {{ 'CoreAdminHome_ImageTrackingIntro1'|translate }} {{ 'CoreAdminHome_ImageTrackingIntro2'|translate("<code><noscript></noscript></code>")|raw }} - </p> - <p> - {{ 'CoreAdminHome_ImageTrackingIntro3'|translate('<a href="https://matomo.org/docs/tracking-api/reference/" rel="noreferrer noopener" target="_blank">','</a>')|raw }} - </p> - - {# website #} - <div piwik-field uicontrol="site" name="image-tracker-website" - ng-model="imageTrackingCode.site" - ng-change="imageTrackingCode.changeSite(true)" - introduction="{{ 'General_Website'|translate|e('html_attr') }}" - value='{{ defaultSite|json_encode }}'> - </div> - - {# action_name #} - <div piwik-field uicontrol="text" name="image-tracker-action-name" - ng-model="imageTrackingCode.pageName" - ng-change="imageTrackingCode.updateTrackingCode()" - data-disabled="imageTrackingCode.isLoading" - introduction="{{ 'General_Options'|translate|e('html_attr') }}" - data-title="{{ 'Actions_ColumnPageName'|translate|e('html_attr') }}" - value=""> - </div> - - {# goal #} - <div piwik-field uicontrol="checkbox" name="image-tracking-goal-check" - ng-model="imageTrackingCode.trackGoal" - ng-change="imageTrackingCode.updateTrackingCode()" - data-disabled="imageTrackingCode.isLoading" - data-title="{{ 'CoreAdminHome_TrackAGoal'|translate|e('html_attr') }}" - value=""> - </div> - - <div ng-show="imageTrackingCode.trackGoal" - id="image-tracking-goal-sub"> - <div class="row"> - <div class="col s12 m6"> - <div piwik-field uicontrol="select" name="image-tracker-goal" - options="imageTrackingCode.allGoals" - data-disabled="imageTrackingCode.isLoading" - ng-model="imageTrackingCode.trackIdGoal" - full-width="true" - ng-change="imageTrackingCode.updateTrackingCode()" - value=""> - </div> - </div> - <div class="col s12 m6"> - <div piwik-field uicontrol="text" name="image-revenue" - ng-model="imageTrackingCode.revenue" - ng-change="imageTrackingCode.updateTrackingCode()" - data-disabled="imageTrackingCode.isLoading" - full-width="true" - data-title="{{ 'CoreAdminHome_WithOptionalRevenue'|translate|e('html_attr') }} <span class='site-currency'></span>" - value=""> - </div> - </div> - </div> - </div> - - <div id="image-link-output-section"> - <h3>{{ 'CoreAdminHome_ImageTrackingLink'|translate }}</h3> - - <div id="image-tracking-text"> - <pre piwik-select-on-focus - ng-bind="imageTrackingCode.trackingCode"> </pre> - </div> - </div> - </div> -</div> +<div + matomo-js-tracking-code-generator + default-site="{{ defaultSiteDecoded|json_encode|e('html_attr') }}" + max-custom-variables="{{ maxCustomVariables|json_encode|e('html_attr') }}" + server-side-do-not-track-enabled="{{ serverSideDoNotTrackEnabled|json_encode|e('html_attr') }}" +></div> + +<div + matomo-image-tracking-code-generator + default-site="{{ defaultSiteDecoded|json_encode|e('html_attr') }}" +></div> <div piwik-content-block content-title="{{ 'CoreAdminHome_ImportingServerLogs'|translate|e('html_attr') }}" anchor="importServerLogs"> diff --git a/plugins/CoreAdminHome/vue/dist/CoreAdminHome.umd.js b/plugins/CoreAdminHome/vue/dist/CoreAdminHome.umd.js index 465ab4c6ab..c1acc43395 100644 --- a/plugins/CoreAdminHome/vue/dist/CoreAdminHome.umd.js +++ b/plugins/CoreAdminHome/vue/dist/CoreAdminHome.umd.js @@ -128,6 +128,8 @@ __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, "ArchivingSettings", function() { return /* reexport */ ArchivingSettings; }); __webpack_require__.d(__webpack_exports__, "BrandingSettings", function() { return /* reexport */ BrandingSettings; }); __webpack_require__.d(__webpack_exports__, "SmtpSettings", function() { return /* reexport */ SmtpSettings; }); +__webpack_require__.d(__webpack_exports__, "JsTrackingCodeGenerator", function() { return /* reexport */ JsTrackingCodeGenerator; }); +__webpack_require__.d(__webpack_exports__, "ImageTrackingCodeGenerator", function() { return /* reexport */ ImageTrackingCodeGenerator; }); // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js // This file is imported into lib/wc client bundles. @@ -1015,6 +1017,1042 @@ SmtpSettingsvue_type_script_lang_ts.render = SmtpSettingsvue_type_template_id_a9 }, directiveName: 'matomoSmtpSettings' })); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.vue?vue&type=template&id=af452db6 + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_1 = { + id: "js-code-options" +}; + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_2 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_4 = ["innerHTML"]; +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_5 = ["innerHTML"]; + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_6 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_7 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_8 = ["innerHTML"]; + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_9 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_10 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_11 = ["innerHTML"]; + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_12 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_13 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_14 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-wordpress/", + target: "_blank", + rel: "noopener" +}, "WordPress", -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_15 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" | "); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_16 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "https://matomo.org/faq/new-to-piwik/how-do-i-integrate-matomo-with-squarespace-website/", + target: "_blank", + rel: "noopener" +}, "Squarespace", -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_17 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" | "); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_18 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-analytics-tracking-code-on-wix/", + target: "_blank", + rel: "noopener" +}, "Wix", -1); + +var JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_19 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" | "); + +var _hoisted_20 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "https://matomo.org/faq/how-to-install/faq_19424/", + target: "_blank", + rel: "noopener" +}, "SharePoint", -1); + +var _hoisted_21 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" | "); + +var _hoisted_22 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-analytics-tracking-code-on-joomla/", + target: "_blank", + rel: "noopener" +}, "Joomla", -1); + +var _hoisted_23 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" | "); + +var _hoisted_24 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-my-shopify-store/", + target: "_blank", + rel: "noopener" +}, "Shopify", -1); + +var _hoisted_25 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" | "); + +var _hoisted_26 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "https://matomo.org/faq/new-to-piwik/how-do-i-use-matomo-analytics-within-gtm-google-tag-manager/", + target: "_blank", + rel: "noopener" +}, "Google Tag Manager", -1); + +var _hoisted_27 = { + id: "javascript-output-section" +}; +var _hoisted_28 = { + class: "valign-wrapper trackingHelpHeader matchWidth" +}; +var _hoisted_29 = { + id: "javascript-text" +}; +var _hoisted_30 = ["textContent"]; +var _hoisted_31 = { + id: "optional-js-tracking-options" +}; +var _hoisted_32 = { + id: "jsTrackAllSubdomainsInlineHelp", + class: "inline-help-node" +}; +var _hoisted_33 = ["innerHTML"]; +var _hoisted_34 = ["innerHTML"]; +var _hoisted_35 = { + id: "jsTrackGroupByDomainInlineHelp", + class: "inline-help-node" +}; +var _hoisted_36 = { + id: "jsTrackAllAliasesInlineHelp", + class: "inline-help-node" +}; +var _hoisted_37 = { + id: "javascript-advanced-options" +}; +var _hoisted_38 = { + id: "javascript-tracking-visitor-cv" +}; +var _hoisted_39 = { + class: "row" +}; +var _hoisted_40 = { + class: "col s12 m3" +}; +var _hoisted_41 = { + class: "col s12 m3" +}; +var _hoisted_42 = { + class: "col s12 m6 l3" +}; +var _hoisted_43 = ["onKeydown"]; +var _hoisted_44 = { + class: "col s12 m6 l3" +}; +var _hoisted_45 = ["onKeydown"]; +var _hoisted_46 = { + class: "row" +}; +var _hoisted_47 = { + class: "col s12" +}; + +var _hoisted_48 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-add" +}, null, -1); + +var _hoisted_49 = { + id: "jsCrossDomain", + class: "inline-help-node" +}; + +var _hoisted_50 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var _hoisted_51 = { + id: "jsDoNotTrackInlineHelp", + class: "inline-help-node" +}; +var _hoisted_52 = { + key: 0 +}; + +var _hoisted_53 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var _hoisted_54 = ["innerHTML"]; +var _hoisted_55 = { + id: "js-campaign-query-param-extra" +}; +var _hoisted_56 = { + class: "row" +}; +var _hoisted_57 = { + class: "col s12" +}; +var _hoisted_58 = { + class: "row" +}; +var _hoisted_59 = { + class: "col s12" +}; +function JsTrackingCodeGeneratorvue_type_template_id_af452db6_render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + + var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + + var _directive_select_on_focus = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("select-on-focus"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_ContentBlock, { + anchor: "javaScriptTracking", + "content-title": _ctx.translate('CoreAdminHome_JavaScriptTracking') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { + return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreAdminHome_JSTrackingIntro1')) + " ", 1), JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_2, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_3, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreAdminHome_JSTrackingIntro2')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + innerHTML: _ctx.jsTrackingIntro3a + }, null, 8, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_4), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + innerHTML: ' ' + _ctx.jsTrackingIntro3b + }, null, 8, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_5), JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_6, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + innerHTML: _ctx.jsTrackingIntro4a + }, null, 8, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_8), JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_9, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_10, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + innerHTML: _ctx.jsTrackingIntro5 + }, null, 8, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_11), JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_12, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_13, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SitesManager_InstallationGuides')) + " : ", 1), JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_14, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_15, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_16, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_17, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_18, JsTrackingCodeGeneratorvue_type_template_id_af452db6_hoisted_19, _hoisted_20, _hoisted_21, _hoisted_22, _hoisted_23, _hoisted_24, _hoisted_25, _hoisted_26]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "site", + name: "js-tracker-website", + class: "jsTrackingCodeWebsite", + modelValue: _ctx.site, + "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { + return _ctx.site = $event; + }), + introduction: _ctx.translate('General_Website') + }, null, 8, ["modelValue", "introduction"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_27, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_28, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_JsTrackingTag')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreAdminHome_JSTracking_CodeNoteBeforeClosingHead', "</head>")), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", { + class: "btn", + id: "emailJsBtn", + onClick: _cache[1] || (_cache[1] = function ($event) { + return _ctx.sendEmail(); + }) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SitesManager_EmailInstructionsButton')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_29, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("pre", { + class: "codeblock", + textContent: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.trackingCode), + ref: "trackingCode" + }, null, 8, _hoisted_30), [[_directive_select_on_focus, {}]])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_31, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_32, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + innerHTML: _ctx.mergeSubdomainsDesc + }, null, 8, _hoisted_33), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + innerHTML: _ctx.learnMoreText + }, null, 8, _hoisted_34)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "javascript-tracking-all-subdomains", + "model-value": _ctx.trackAllSubdomains, + "onUpdate:modelValue": _cache[2] || (_cache[2] = function ($event) { + _ctx.trackAllSubdomains = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + introduction: _ctx.translate('General_Options'), + title: "".concat(_ctx.translate('CoreAdminHome_JSTracking_MergeSubdomains'), " ").concat(_ctx.currentSiteName), + "inline-help": "#jsTrackAllSubdomainsInlineHelp" + }, null, 8, ["model-value", "disabled", "introduction", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_35, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreAdminHome_JSTracking_GroupPageTitlesByDomainDesc1', _ctx.currentSiteHost)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "javascript-tracking-group-by-domain", + "model-value": _ctx.groupByDomain, + "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) { + _ctx.groupByDomain = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + title: _ctx.translate('CoreAdminHome_JSTracking_GroupPageTitlesByDomain'), + "inline-help": "#jsTrackGroupByDomainInlineHelp" + }, null, 8, ["model-value", "disabled", "title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_36, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreAdminHome_JSTracking_MergeAliasesDesc', _ctx.currentSiteAlias)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "javascript-tracking-all-aliases", + "model-value": _ctx.trackAllAliases, + "onUpdate:modelValue": _cache[4] || (_cache[4] = function ($event) { + _ctx.trackAllAliases = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + title: "".concat(_ctx.translate('CoreAdminHome_JSTracking_MergeAliases'), " ").concat(_ctx.currentSiteName), + "inline-help": "#jsTrackAllAliasesInlineHelp" + }, null, 8, ["model-value", "disabled", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "javascript-tracking-noscript", + "model-value": _ctx.trackNoScript, + "onUpdate:modelValue": _cache[5] || (_cache[5] = function ($event) { + _ctx.trackNoScript = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + title: _ctx.translate('CoreAdminHome_JSTracking_TrackNoScript') + }, null, 8, ["model-value", "disabled", "title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Mobile_Advanced')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "javascript:;", + onClick: _cache[6] || (_cache[6] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.showAdvanced = true; + }, ["prevent"])) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Show')), 513), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.showAdvanced]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "javascript:;", + onClick: _cache[7] || (_cache[7] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])(function ($event) { + return _ctx.showAdvanced = false; + }, ["prevent"])) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Hide')), 513), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.showAdvanced]])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_37, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "javascript-tracking-visitor-cv-check", + "model-value": _ctx.trackCustomVars, + "onUpdate:modelValue": _cache[8] || (_cache[8] = function ($event) { + _ctx.trackCustomVars = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + title: _ctx.translate('CoreAdminHome_JSTracking_VisitorCustomVars'), + "inline-help": _ctx.translate('CoreAdminHome_JSTracking_VisitorCustomVarsDesc') + }, null, 8, ["model-value", "disabled", "title", "inline-help"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_38, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_39, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_40, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_41, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Value')), 1)]), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.customVars, function (customVar, index) { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + class: "row", + key: index + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_42, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "text", + class: "custom-variable-name", + onKeydown: function onKeydown($event) { + return _ctx.onCustomVarNameKeydown($event, index); + }, + placeholder: "e.g. Type" + }, null, 40, _hoisted_43)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_44, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "text", + class: "custom-variable-value", + onKeydown: function onKeydown($event) { + return _ctx.onCustomVarValueKeydown($event, index); + }, + placeholder: "e.g. Customer" + }, null, 40, _hoisted_45)])]); + }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_46, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_47, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: "javascript:;", + onClick: _cache[9] || (_cache[9] = function ($event) { + return _ctx.addCustomVar(); + }), + class: "add-custom-variable" + }, [_hoisted_48, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Add')), 1)])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.canAddMoreCustomVariables]])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.trackCustomVars]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_49, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreAdminHome_JSTracking_CrossDomain')) + " ", 1), _hoisted_50, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreAdminHome_JSTracking_CrossDomain_NeedsMultipleDomains')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "javascript-tracking-cross-domain", + "model-value": _ctx.crossDomain, + "onUpdate:modelValue": _cache[10] || (_cache[10] = function ($event) { + _ctx.crossDomain = $event; + + _ctx.updateTrackingCode(); + + _ctx.onCrossDomainToggle(); + }), + disabled: _ctx.isLoading || !_ctx.hasManySiteUrls, + title: _ctx.translate('CoreAdminHome_JSTracking_EnableCrossDomainLinking'), + "inline-help": "#jsCrossDomain" + }, null, 8, ["model-value", "disabled", "title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_51, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreAdminHome_JSTracking_EnableDoNotTrackDesc')) + " ", 1), _ctx.serverSideDoNotTrackEnabled ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_52, [_hoisted_53, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreAdminHome_JSTracking_EnableDoNotTrack_AlreadyEnabled')), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "javascript-tracking-do-not-track", + "model-value": _ctx.doNotTrack, + "onUpdate:modelValue": _cache[11] || (_cache[11] = function ($event) { + _ctx.doNotTrack = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + title: _ctx.translate('CoreAdminHome_JSTracking_EnableDoNotTrack'), + "inline-help": "#jsDoNotTrackInlineHelp" + }, null, 8, ["model-value", "disabled", "title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "javascript-tracking-disable-cookies", + "model-value": _ctx.disableCookies, + "onUpdate:modelValue": _cache[12] || (_cache[12] = function ($event) { + _ctx.disableCookies = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + title: _ctx.translate('CoreAdminHome_JSTracking_DisableCookies'), + "inline-help": _ctx.translate('CoreAdminHome_JSTracking_DisableCookiesDesc') + }, null, 8, ["model-value", "disabled", "title", "inline-help"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + id: "jsTrackCampaignParamsInlineHelp", + class: "inline-help-node", + innerHTML: _ctx.jsTrackCampaignParamsInlineHelp + }, null, 8, _hoisted_54), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "custom-campaign-query-params-check", + "model-value": _ctx.useCustomCampaignParams, + "onUpdate:modelValue": _cache[13] || (_cache[13] = function ($event) { + _ctx.useCustomCampaignParams = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + title: _ctx.translate('CoreAdminHome_JSTracking_CustomCampaignQueryParam'), + "inline-help": "#jsTrackCampaignParamsInlineHelp" + }, null, 8, ["model-value", "disabled", "title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_55, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_56, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_57, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "custom-campaign-name-query-param", + "model-value": _ctx.customCampaignName, + "onUpdate:modelValue": _cache[14] || (_cache[14] = function ($event) { + _ctx.customCampaignName = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + title: _ctx.translate('CoreAdminHome_JSTracking_CampaignNameParam') + }, null, 8, ["model-value", "disabled", "title"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_58, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_59, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "custom-campaign-keyword-query-param", + "model-value": _ctx.customCampaignKeyword, + "onUpdate:modelValue": _cache[15] || (_cache[15] = function ($event) { + _ctx.customCampaignKeyword = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + title: _ctx.translate('CoreAdminHome_JSTracking_CampaignKwdParam') + }, null, 8, ["model-value", "disabled", "title"])])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.useCustomCampaignParams]])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.showAdvanced]])]; + }), + _: 1 + }, 8, ["content-title"]); +} +// CONCATENATED MODULE: ./plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.vue?vue&type=template&id=af452db6 + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.vue?vue&type=script&lang=ts + + + + +function getHostNameFromUrl(url) { + var urlObj = new URL(url); + return urlObj.hostname; +} + +function getCustomVarArray(cvars) { + return cvars.map(function (cv) { + return [cv.name, cv.value]; + }); +} + +var JsTrackingCodeGeneratorvue_type_script_lang_ts_window = window, + JsTrackingCodeGeneratorvue_type_script_lang_ts_$ = JsTrackingCodeGeneratorvue_type_script_lang_ts_window.$; +var piwikHost = window.location.host; +var piwikPath = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')); +/* harmony default export */ var JsTrackingCodeGeneratorvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + defaultSite: { + type: Object, + required: true + }, + maxCustomVariables: Number, + serverSideDoNotTrackEnabled: Boolean + }, + data: function data() { + return { + showAdvanced: false, + site: this.defaultSite, + trackingCode: '', + trackAllSubdomains: false, + isLoading: false, + siteUrls: {}, + siteExcludedQueryParams: {}, + crossDomain: false, + groupByDomain: false, + trackAllAliases: false, + trackNoScript: false, + trackCustomVars: false, + customVars: [], + canAddMoreCustomVariables: !!this.maxCustomVariables && this.maxCustomVariables > 0, + doNotTrack: false, + disableCookies: false, + useCustomCampaignParams: false, + customCampaignName: '', + customCampaignKeyword: '', + trackingCodeAbortController: null, + isHighlighting: false + }; + }, + components: { + ContentBlock: external_CoreHome_["ContentBlock"], + Field: external_CorePluginsAdmin_["Field"] + }, + directives: { + SelectOnFocus: external_CoreHome_["SelectOnFocus"] + }, + created: function created() { + this.onCustomVarNameKeydown = Object(external_CoreHome_["debounce"])(this.onCustomVarNameKeydown, 100); + this.onCustomVarValueKeydown = Object(external_CoreHome_["debounce"])(this.onCustomVarValueKeydown, 100); + this.addCustomVar(); + + if (this.site && this.site.id) { + this.onSiteChanged(this.site); + } + }, + watch: { + site: function site(newValue) { + this.onSiteChanged(newValue); + } + }, + methods: { + onSiteChanged: function onSiteChanged(newValue) { + var _this = this; + + var idSite = newValue.id; // if data is already loaded, don't do an AJAX request + + var promises = []; + + if (!this.siteUrls[idSite]) { + this.isLoading = true; + promises.push(external_CoreHome_["AjaxHelper"].fetch({ + module: 'API', + method: 'SitesManager.getSiteUrlsFromId', + idSite: idSite, + filter_limit: '-1' + }).then(function (data) { + _this.siteUrls[idSite] = data || []; + })); + } + + if (!this.siteExcludedQueryParams[idSite]) { + this.isLoading = true; + promises.push(external_CoreHome_["AjaxHelper"].fetch({ + module: 'API', + method: 'Overlay.getExcludedQueryParameters', + idSite: idSite, + filter_limit: '-1' + }).then(function (data) { + _this.siteExcludedQueryParams[idSite] = data || []; + })); + } + + Promise.all(promises).then(function () { + _this.isLoading = false; + + _this.updateCurrentSiteInfo(); + + _this.updateTrackingCode(); + }); + }, + sendEmail: function sendEmail() { + var subjectLine = Object(external_CoreHome_["translate"])('SitesManager_EmailInstructionsSubject'); + subjectLine = encodeURIComponent(subjectLine); + var trackingCode = this.trackingCode; + trackingCode = trackingCode.replace(/<[^>]+>/g, ''); + var bodyText = "".concat(Object(external_CoreHome_["translate"])('SitesManager_JsTrackingTagHelp'), ". ").concat(Object(external_CoreHome_["translate"])('CoreAdminHome_JSTracking_CodeNoteBeforeClosingHeadEmail', '\'head'), "\n").concat(trackingCode); + bodyText = encodeURIComponent(bodyText); + var linkText = "mailto:?subject=".concat(subjectLine, "&body=").concat(bodyText); + window.location.href = linkText; + }, + onCrossDomainToggle: function onCrossDomainToggle() { + if (this.crossDomain) { + this.trackAllAliases = true; + } + }, + updateTrackingCode: function updateTrackingCode() { + var _this2 = this; + + var site = this.site; // get params used to generate JS code + + var params = { + piwikUrl: "".concat(piwikHost).concat(piwikPath), + groupPageTitlesByDomain: this.groupByDomain ? 1 : 0, + mergeSubdomains: this.trackAllSubdomains ? 1 : 0, + mergeAliasUrls: this.trackAllAliases ? 1 : 0, + visitorCustomVariables: this.trackCustomVars ? getCustomVarArray(this.customVars) : 0, + customCampaignNameQueryParam: null, + customCampaignKeywordParam: null, + doNotTrack: this.doNotTrack ? 1 : 0, + disableCookies: this.disableCookies ? 1 : 0, + crossDomain: this.crossDomain ? 1 : 0, + trackNoScript: this.trackNoScript ? 1 : 0, + forceMatomoEndpoint: 1 + }; + + if (this.siteExcludedQueryParams[site.id]) { + params.excludedQueryParams = this.siteExcludedQueryParams[site.id]; + } + + if (this.useCustomCampaignParams) { + params.customCampaignNameQueryParam = this.customCampaignName; + params.customCampaignKeywordParam = this.customCampaignKeyword; + } + + if (this.trackingCodeAbortController) { + this.trackingCodeAbortController.abort(); + this.trackingCodeAbortController = null; + } + + this.trackingCodeAbortController = new AbortController(); + external_CoreHome_["AjaxHelper"].post({ + module: 'API', + format: 'json', + method: 'SitesManager.getJavascriptTag', + idSite: site.id + }, params, { + abortController: this.trackingCodeAbortController + }).then(function (response) { + _this2.trackingCodeAbortController = null; + _this2.trackingCode = response.value; + var jsCodeTextarea = JsTrackingCodeGeneratorvue_type_script_lang_ts_$(_this2.$refs.trackingCode); + + if (jsCodeTextarea && !_this2.isHighlighting) { + _this2.isHighlighting = true; + jsCodeTextarea.effect('highlight', { + complete: function complete() { + _this2.isHighlighting = false; + } + }, 1500); + } + }); + }, + updateCurrentSiteInfo: function updateCurrentSiteInfo() { + if (!this.hasManySiteUrls) { + // we make sure to disable cross domain if it has only one url or less + this.crossDomain = false; + } + }, + addCustomVar: function addCustomVar() { + if (this.canAddMoreCustomVariables) { + this.customVars.push({ + name: '', + value: '' + }); + } + + this.canAddMoreCustomVariables = !!this.maxCustomVariables && this.maxCustomVariables > this.customVars.length; + }, + onCustomVarNameKeydown: function onCustomVarNameKeydown(event, index) { + var _this3 = this; + + setTimeout(function () { + _this3.customVars[index].name = event.target.value; + + _this3.updateTrackingCode(); + }); + }, + onCustomVarValueKeydown: function onCustomVarValueKeydown(event, index) { + var _this4 = this; + + setTimeout(function () { + _this4.customVars[index].value = event.target.value; + + _this4.updateTrackingCode(); + }); + } + }, + computed: { + hasManySiteUrls: function hasManySiteUrls() { + var site = this.site; + return this.siteUrls[site.id] && this.siteUrls[site.id].length > 1; + }, + currentSiteHost: function currentSiteHost() { + var _this$siteUrls$this$s; + + var siteUrl = (_this$siteUrls$this$s = this.siteUrls[this.site.id]) === null || _this$siteUrls$this$s === void 0 ? void 0 : _this$siteUrls$this$s[0]; + + if (!siteUrl) { + return ''; + } + + return getHostNameFromUrl(siteUrl); + }, + currentSiteAlias: function currentSiteAlias() { + var _this$siteUrls$this$s2; + + var defaultAliasUrl = "x.".concat(this.currentSiteHost); + var alias = (_this$siteUrls$this$s2 = this.siteUrls[this.site.id]) === null || _this$siteUrls$this$s2 === void 0 ? void 0 : _this$siteUrls$this$s2[1]; + return alias || defaultAliasUrl; + }, + currentSiteName: function currentSiteName() { + return external_CoreHome_["Matomo"].helper.htmlEntities(this.site.name); + }, + jsTrackingIntro3a: function jsTrackingIntro3a() { + return Object(external_CoreHome_["translate"])('CoreAdminHome_JSTrackingIntro3a', '<a href="https://matomo.org/integrate/" rel="noreferrer noopener" target="_blank">', '</a>'); + }, + jsTrackingIntro3b: function jsTrackingIntro3b() { + return Object(external_CoreHome_["translate"])('CoreAdminHome_JSTrackingIntro3b'); + }, + jsTrackingIntro4a: function jsTrackingIntro4a() { + return Object(external_CoreHome_["translate"])('CoreAdminHome_JSTrackingIntro4', '<a href="#image-tracking-link">', '</a>'); + }, + jsTrackingIntro5: function jsTrackingIntro5() { + return Object(external_CoreHome_["translate"])('CoreAdminHome_JSTrackingIntro5', '<a rel="noreferrer noopener" target="_blank" ' + 'href="https://developer.matomo.org/guides/tracking-javascript-guide">', '</a>'); + }, + mergeSubdomainsDesc: function mergeSubdomainsDesc() { + return Object(external_CoreHome_["translate"])('CoreAdminHome_JSTracking_MergeSubdomainsDesc', "x.".concat(this.currentSiteHost), "y.".concat(this.currentSiteHost)); + }, + learnMoreText: function learnMoreText() { + var subdomainsLink = 'https://developer.matomo.org/guides/tracking-javascript-guide' + '#measuring-domains-andor-sub-domains'; + return Object(external_CoreHome_["translate"])('General_LearnMore', " (<a href=\"".concat(subdomainsLink, "\" rel=\"noreferrer noopener\" target=\"_blank\">"), '</a>)'); + }, + jsTrackCampaignParamsInlineHelp: function jsTrackCampaignParamsInlineHelp() { + return Object(external_CoreHome_["translate"])('CoreAdminHome_JSTracking_CustomCampaignQueryParamDesc', '<a href="https://matomo.org/faq/general/#faq_119" rel="noreferrer noopener" target="_blank">', '</a>'); + } + } +})); +// CONCATENATED MODULE: ./plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.vue + + + +JsTrackingCodeGeneratorvue_type_script_lang_ts.render = JsTrackingCodeGeneratorvue_type_template_id_af452db6_render + +/* harmony default export */ var JsTrackingCodeGenerator = (JsTrackingCodeGeneratorvue_type_script_lang_ts); +// CONCATENATED MODULE: ./plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.adapter.ts +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + + +/* harmony default export */ var JsTrackingCodeGenerator_adapter = (Object(external_CoreHome_["createAngularJsAdapter"])({ + component: JsTrackingCodeGenerator, + scope: { + defaultSite: { + angularJsBind: '<' + }, + maxCustomVariables: { + angularJsBind: '<' + }, + serverSideDoNotTrackEnabled: { + angularJsBind: '<' + } + }, + directiveName: 'matomoJsTrackingCodeGenerator' +})); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.vue?vue&type=template&id=5c57c814 + + +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_1 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + name: "image-tracking-link" +}, null, -1); + +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_2 = { + id: "image-tracking-code-options" +}; +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_3 = ["innerHTML"]; +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_4 = ["innerHTML"]; +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_5 = { + id: "image-tracking-goal-sub" +}; +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_6 = { + class: "row" +}; +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_7 = { + class: "col s12 m6" +}; +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_8 = { + class: "col s12 m6" +}; +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_9 = { + id: "image-link-output-section" +}; +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_10 = { + id: "image-tracking-text" +}; +var ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_11 = ["textContent"]; +function ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + + var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + + var _directive_select_on_focus = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("select-on-focus"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_ContentBlock, { + "content-title": _ctx.translate('CoreAdminHome_ImageTracking'), + anchor: "imageTracking" + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { + return [ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_1, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { + innerHTML: _ctx.imageTrackingIntro + }, null, 8, ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_3), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { + innerHTML: _ctx.imageTrackingIntro3 + }, null, 8, ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_4), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "site", + name: "image-tracker-website", + modelValue: _ctx.site, + "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { + return _ctx.site = $event; + }), + introduction: _ctx.translate('General_Website') + }, null, 8, ["modelValue", "introduction"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "image-tracker-action-name", + "model-value": _ctx.pageName, + "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { + _ctx.pageName = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + introduction: _ctx.translate('General_Options'), + title: _ctx.translate('Actions_ColumnPageName') + }, null, 8, ["model-value", "disabled", "introduction", "title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "image-tracking-goal-check", + "model-value": _ctx.trackGoal, + "onUpdate:modelValue": _cache[2] || (_cache[2] = function ($event) { + _ctx.trackGoal = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + title: _ctx.translate('CoreAdminHome_TrackAGoal') + }, null, 8, ["model-value", "disabled", "title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "image-tracker-goal", + options: _ctx.siteGoals, + disabled: _ctx.isLoading, + "model-value": _ctx.trackIdGoal, + "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) { + _ctx.trackIdGoal = $event; + + _ctx.updateTrackingCode(); + }) + }, null, 8, ["options", "disabled", "model-value"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "image-revenue", + "model-value": _ctx.revenue, + "onUpdate:modelValue": _cache[4] || (_cache[4] = function ($event) { + _ctx.revenue = $event; + + _ctx.updateTrackingCode(); + }), + disabled: _ctx.isLoading, + "full-width": true, + title: "".concat(_ctx.translate('CoreAdminHome_WithOptionalRevenue'), " ").concat(_ctx.currentSiteCurrency) + }, null, 8, ["model-value", "disabled", "title"])])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.trackGoal]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreAdminHome_ImageTrackingLink')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("pre", { + textContent: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.trackingCode), + ref: "trackingCode" + }, null, 8, ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_hoisted_11), [[_directive_select_on_focus, {}]])])])])]; + }), + _: 1 + }, 8, ["content-title"]); +} +// CONCATENATED MODULE: ./plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.vue?vue&type=template&id=5c57c814 + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.vue?vue&type=script&lang=ts +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + + + + +var currencySymbols = null; +var ImageTrackingCodeGeneratorvue_type_script_lang_ts_window = window, + ImageTrackingCodeGeneratorvue_type_script_lang_ts_$ = ImageTrackingCodeGeneratorvue_type_script_lang_ts_window.$; +var ImageTrackingCodeGeneratorvue_type_script_lang_ts_piwikHost = window.location.host; +var ImageTrackingCodeGeneratorvue_type_script_lang_ts_piwikPath = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')); +/* harmony default export */ var ImageTrackingCodeGeneratorvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + defaultSite: { + type: Object, + required: true + } + }, + components: { + ContentBlock: external_CoreHome_["ContentBlock"], + Field: external_CorePluginsAdmin_["Field"] + }, + directives: { + SelectOnFocus: external_CoreHome_["SelectOnFocus"] + }, + data: function data() { + return { + isLoading: false, + site: this.defaultSite, + pageName: '', + trackGoal: false, + trackIdGoal: null, + revenue: '', + trackingCode: '', + sites: {}, + goals: {}, + trackingCodeAbortController: null, + isHighlighting: false + }; + }, + created: function created() { + this.updateTrackingCode = Object(external_CoreHome_["debounce"])(this.updateTrackingCode); + + if (this.site && this.site.id) { + this.onSiteChanged(this.site); + } + }, + watch: { + site: function site(newValue) { + this.onSiteChanged(newValue); + } + }, + methods: { + onSiteChanged: function onSiteChanged(newValue) { + var _this = this; + + this.trackIdGoal = null; + var currencyPromise; + + if (currencySymbols) { + currencyPromise = Promise.resolve(currencySymbols); + } else { + this.isLoading = true; + currencyPromise = external_CoreHome_["AjaxHelper"].fetch({ + method: 'SitesManager.getCurrencySymbols', + filter_limit: '-1' + }); + } + + var sitePromise; + + if (this.sites[newValue.id]) { + sitePromise = Promise.resolve(this.sites[newValue.id]); + } else { + this.isLoading = true; + sitePromise = external_CoreHome_["AjaxHelper"].fetch({ + module: 'API', + method: 'SitesManager.getSiteFromId', + idSite: newValue.id + }); + } + + var goalPromise; + + if (this.goals[newValue.id]) { + goalPromise = Promise.resolve(this.goals[newValue.id]); + } else { + this.isLoading = true; + goalPromise = external_CoreHome_["AjaxHelper"].fetch({ + module: 'API', + method: 'Goals.getGoals', + filter_limit: '-1', + idSite: newValue.id + }); + } + + return Promise.all([currencyPromise, sitePromise, goalPromise]).then(function (_ref) { + var _ref2 = _slicedToArray(_ref, 3), + currencyResponse = _ref2[0], + site = _ref2[1], + goalsResponse = _ref2[2]; + + _this.isLoading = false; + currencySymbols = currencyResponse; + _this.sites[newValue.id] = site; + _this.goals[newValue.id] = goalsResponse; + + _this.updateTrackingCode(); + }); + }, + updateTrackingCode: function updateTrackingCode() { + var _this2 = this; + + // get data used to generate the link + var postParams = { + piwikUrl: "".concat(ImageTrackingCodeGeneratorvue_type_script_lang_ts_piwikHost).concat(ImageTrackingCodeGeneratorvue_type_script_lang_ts_piwikPath), + actionName: this.pageName, + forceMatomoEndpoint: 1 + }; + + if (this.trackGoal && this.trackIdGoal) { + postParams.idGoal = this.trackIdGoal; + postParams.revenue = this.revenue; + } + + if (this.trackingCodeAbortController) { + this.trackingCodeAbortController.abort(); + this.trackingCodeAbortController = null; + } + + this.trackingCodeAbortController = new AbortController(); + external_CoreHome_["AjaxHelper"].post({ + module: 'API', + format: 'json', + method: 'SitesManager.getImageTrackingCode', + idSite: this.site.id + }, postParams, { + abortController: this.trackingCodeAbortController + }).then(function (response) { + _this2.trackingCodeAbortController = null; + _this2.trackingCode = response.value; + var imageCodeTextarea = ImageTrackingCodeGeneratorvue_type_script_lang_ts_$(_this2.$refs.trackingCode); + + if (imageCodeTextarea && !_this2.isHighlighting) { + _this2.isHighlighting = true; + imageCodeTextarea.effect('highlight', { + complete: function complete() { + _this2.isHighlighting = false; + } + }, 1500); + } + }); + } + }, + computed: { + currentSiteCurrency: function currentSiteCurrency() { + if (!currencySymbols) { + return ''; + } + + return currencySymbols[(this.sites[this.site.id].currency || '').toUpperCase()]; + }, + siteGoals: function siteGoals() { + var goalsResponse = this.goals[this.site.id]; + return [{ + key: '', + value: Object(external_CoreHome_["translate"])('UserCountryMap_None') + }].concat(Object.values(goalsResponse || []).map(function (g) { + return { + key: "".concat(g.idgoal), + value: g.name + }; + })); + }, + imageTrackingIntro: function imageTrackingIntro() { + var first = Object(external_CoreHome_["translate"])('CoreAdminHome_ImageTrackingIntro1'); + var second = Object(external_CoreHome_["translate"])('CoreAdminHome_ImageTrackingIntro2', '<code><noscript></noscript></code>'); + return "".concat(first, " ").concat(second); + }, + imageTrackingIntro3: function imageTrackingIntro3() { + var link = 'https://matomo.org/docs/tracking-api/reference/'; + return Object(external_CoreHome_["translate"])('CoreAdminHome_ImageTrackingIntro3', "<a href=\"".concat(link, "\" rel=\"noreferrer noopener\" target=\"_blank\">"), '</a>'); + } + } +})); +// CONCATENATED MODULE: ./plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.vue + + + +ImageTrackingCodeGeneratorvue_type_script_lang_ts.render = ImageTrackingCodeGeneratorvue_type_template_id_5c57c814_render + +/* harmony default export */ var ImageTrackingCodeGenerator = (ImageTrackingCodeGeneratorvue_type_script_lang_ts); +// CONCATENATED MODULE: ./plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.adapter.ts +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + + +/* harmony default export */ var ImageTrackingCodeGenerator_adapter = (Object(external_CoreHome_["createAngularJsAdapter"])({ + component: ImageTrackingCodeGenerator, + scope: { + defaultSite: { + angularJsBind: '<' + } + }, + directiveName: 'matomoImageTrackingCodeGenerator' +})); // CONCATENATED MODULE: ./plugins/CoreAdminHome/vue/src/index.ts /*! * Matomo - free/libre analytics platform @@ -1028,6 +2066,10 @@ SmtpSettingsvue_type_script_lang_ts.render = SmtpSettingsvue_type_template_id_a9 + + + + // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib-no-default.js diff --git a/plugins/CoreAdminHome/vue/dist/CoreAdminHome.umd.min.js b/plugins/CoreAdminHome/vue/dist/CoreAdminHome.umd.min.js index e0e3d6a966..b9a9370c9a 100644 --- a/plugins/CoreAdminHome/vue/dist/CoreAdminHome.umd.min.js +++ b/plugins/CoreAdminHome/vue/dist/CoreAdminHome.umd.min.js @@ -1,20 +1,32 @@ -(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["CoreAdminHome"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["CoreAdminHome"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="plugins/CoreAdminHome/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"8bbf":function(e,n){e.exports=t},a5a2:function(e,t){e.exports=n},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"ArchivingSettings",(function(){return w})),n.d(t,"BrandingSettings",(function(){return Q})),n.d(t,"SmtpSettings",(function(){return te})),"undefined"!==typeof window){var o=window.document.currentScript,r=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);r&&(n.p=r[1])}var a=n("19dc"),i=n("8bbf"),l={class:"form-group row"},c={class:"col s12"},s={class:"col s12 m6"},d={class:"form-description",style:{"margin-left":"4px"}},m={for:"enableBrowserTriggerArchiving2"},u=["innerHTML"],p={class:"col s12 m6"},g=["innerHTML"],h={class:"form-group row"},v={class:"col s12"},b={class:"input-field col s12 m6"},f=["disabled"],j={class:"form-description"},O={class:"col s12 m6"},y={key:0,class:"form-help"},S={key:0},V=Object(i["createElementVNode"])("br",null,null,-1),C=Object(i["createElementVNode"])("br",null,null,-1),B=Object(i["createElementVNode"])("br",null,null,-1);function A(e,t,n,o,r,a){var A=Object(i["resolveComponent"])("SaveButton"),T=Object(i["resolveComponent"])("ContentBlock");return Object(i["openBlock"])(),Object(i["createBlock"])(T,{"content-title":e.translate("CoreAdminHome_ArchivingSettings"),anchor:"archivingSettings",class:"matomo-archiving-settings"},{default:Object(i["withCtx"])((function(){return[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("div",l,[Object(i["createElementVNode"])("h3",c,Object(i["toDisplayString"])(e.translate("General_AllowPiwikArchivingToTriggerBrowser")),1),Object(i["createElementVNode"])("div",s,[Object(i["createElementVNode"])("p",null,[Object(i["createElementVNode"])("label",null,[Object(i["withDirectives"])(Object(i["createElementVNode"])("input",{type:"radio",id:"enableBrowserTriggerArchiving1",name:"enableBrowserTriggerArchiving",value:"1","onUpdate:modelValue":t[0]||(t[0]=function(t){return e.enableBrowserTriggerArchivingValue=t})},null,512),[[i["vModelRadio"],e.enableBrowserTriggerArchivingValue]]),Object(i["createElementVNode"])("span",null,Object(i["toDisplayString"])(e.translate("General_Yes")),1),Object(i["createElementVNode"])("span",d,Object(i["toDisplayString"])(e.translate("General_Default")),1)])]),Object(i["createElementVNode"])("p",null,[Object(i["createElementVNode"])("label",m,[Object(i["withDirectives"])(Object(i["createElementVNode"])("input",{type:"radio",id:"enableBrowserTriggerArchiving2",name:"enableBrowserTriggerArchiving",value:"0","onUpdate:modelValue":t[1]||(t[1]=function(t){return e.enableBrowserTriggerArchivingValue=t})},null,512),[[i["vModelRadio"],e.enableBrowserTriggerArchivingValue]]),Object(i["createElementVNode"])("span",null,Object(i["toDisplayString"])(e.translate("General_No")),1),Object(i["createElementVNode"])("span",{class:"form-description",innerHTML:e.archivingTriggerDesc,style:{"margin-left":"4px"}},null,8,u)])])]),Object(i["createElementVNode"])("div",p,[Object(i["createElementVNode"])("div",{class:"form-help",innerHTML:e.archivingInlineHelp},null,8,g)])]),Object(i["createElementVNode"])("div",h,[Object(i["createElementVNode"])("h3",v,Object(i["toDisplayString"])(e.translate("General_ReportsContainingTodayWillBeProcessedAtMostEvery")),1),Object(i["createElementVNode"])("div",b,[Object(i["withDirectives"])(Object(i["createElementVNode"])("input",{type:"text","onUpdate:modelValue":t[2]||(t[2]=function(t){return e.todayArchiveTimeToLiveValue=t}),id:"todayArchiveTimeToLive",disabled:!e.isGeneralSettingsAdminEnabled},null,8,f),[[i["vModelText"],e.todayArchiveTimeToLiveValue]]),Object(i["createElementVNode"])("span",j,Object(i["toDisplayString"])(e.translate("General_RearchiveTimeIntervalOnlyForTodayReports")),1)]),Object(i["createElementVNode"])("div",O,[e.isGeneralSettingsAdminEnabled?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",y,[e.showWarningCron?(Object(i["openBlock"])(),Object(i["createElementBlock"])("strong",S,[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("General_NewReportsWillBeProcessedByCron")),1),V,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_ReportsWillBeProcessedAtMostEveryHour"))+" "+Object(i["toDisplayString"])(e.translate("General_IfArchivingIsFastYouCanSetupCronRunMoreOften")),1),C])):Object(i["createCommentVNode"])("",!0),Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_SmallTrafficYouCanLeaveDefault",e.todayArchiveTimeToLiveDefault))+" ",1),B,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_MediumToHighTrafficItIsRecommendedTo",1800,3600)),1)])):Object(i["createCommentVNode"])("",!0)])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(A,{saving:e.isLoading,onConfirm:t[3]||(t[3]=function(t){return e.save()})},null,8,["saving"])])])]})),_:1},8,["content-title"])}var T=n("a5a2"),N=Object(i["defineComponent"])({props:{enableBrowserTriggerArchiving:Boolean,showSegmentArchiveTriggerInfo:Boolean,isGeneralSettingsAdminEnabled:Boolean,showWarningCron:Boolean,todayArchiveTimeToLive:Number,todayArchiveTimeToLiveDefault:Number},components:{ContentBlock:a["ContentBlock"],SaveButton:T["SaveButton"]},data:function(){return{isLoading:!1,enableBrowserTriggerArchivingValue:this.enableBrowserTriggerArchiving?1:0,todayArchiveTimeToLiveValue:this.todayArchiveTimeToLive}},watch:{enableBrowserTriggerArchiving:function(e){this.enableBrowserTriggerArchivingValue=e?1:0},todayArchiveTimeToLive:function(e){this.todayArchiveTimeToLiveValue=e}},computed:{archivingTriggerDesc:function(){var e="";return e+=Object(a["translate"])("General_ArchivingTriggerDescription",'<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/docs/setup-auto-archiving/">',"</a>"),this.showSegmentArchiveTriggerInfo&&(e+=Object(a["translate"])("General_ArchivingTriggerSegment")),e},archivingInlineHelp:function(){var e=Object(a["translate"])("General_ArchivingInlineHelp");return e+="<br/>",e+=Object(a["translate"])("General_SeeTheOfficialDocumentationForMoreInformation",'<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/docs/setup-auto-archiving/">',"</a>"),e}},methods:{save:function(){var e=this;this.isLoading=!0,a["AjaxHelper"].post({module:"API",method:"CoreAdminHome.setArchiveSettings"},{enableBrowserTriggerArchiving:this.enableBrowserTriggerArchivingValue,todayArchiveTimeToLive:this.todayArchiveTimeToLiveValue}).then((function(){e.isLoading=!1;var t=a["NotificationsStore"].show({message:Object(a["translate"])("CoreAdminHome_SettingsSaveSuccess"),type:"transient",id:"generalSettings",context:"success"});a["NotificationsStore"].scrollToNotification(t)})).finally((function(){e.isLoading=!1}))}}});N.render=A;var w=N,E=(Object(a["createAngularJsAdapter"])({component:w,scope:{enableBrowserTriggerArchiving:{angularJsBind:"<"},showSegmentArchiveTriggerInfo:{angularJsBind:"<"},isGeneralSettingsAdminEnabled:{angularJsBind:"<"},showWarningCron:{angularJsBind:"<"},todayArchiveTimeToLive:{angularJsBind:"<"},todayArchiveTimeToLiveDefault:{angularJsBind:"<"}},directiveName:"matomoArchivingSettings"}),{id:"logoSettings"}),L={id:"logoUploadForm",ref:"logoUploadForm",method:"post",enctype:"multipart/form-data",action:"index.php?module=CoreAdminHome&format=json&action=uploadCustomLogo"},U={key:0},_=["value"],F=Object(i["createElementVNode"])("input",{type:"hidden",name:"force_api_session",value:"1"},null,-1),H={key:0},k={key:0,class:"alert alert-warning uploaderror"},x={class:"row"},G={class:"col s12"},P=["src"],D={class:"row"},M={class:"col s12"},I=["src"],J={key:1},q=["innerHTML"],W={key:1},R={class:"alert alert-warning"}; +(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["CoreAdminHome"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["CoreAdminHome"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var a=t[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(o,a,function(t){return e[t]}.bind(null,a));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="plugins/CoreAdminHome/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"8bbf":function(e,n){e.exports=t},a5a2:function(e,t){e.exports=n},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"ArchivingSettings",(function(){return w})),n.d(t,"BrandingSettings",(function(){return z})),n.d(t,"SmtpSettings",(function(){return te})),n.d(t,"JsTrackingCodeGenerator",(function(){return bt})),n.d(t,"ImageTrackingCodeGenerator",(function(){return Gt})),"undefined"!==typeof window){var o=window.document.currentScript,a=o&&o.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);a&&(n.p=a[1])}var r=n("19dc"),i=n("8bbf"),l={class:"form-group row"},c={class:"col s12"},s={class:"col s12 m6"},d={class:"form-description",style:{"margin-left":"4px"}},m={for:"enableBrowserTriggerArchiving2"},u=["innerHTML"],g={class:"col s12 m6"},p=["innerHTML"],b={class:"form-group row"},h={class:"col s12"},v={class:"input-field col s12 m6"},j=["disabled"],f={class:"form-description"},O={class:"col s12 m6"},C={key:0,class:"form-help"},k={key:0},V=Object(i["createElementVNode"])("br",null,null,-1),S=Object(i["createElementVNode"])("br",null,null,-1),T=Object(i["createElementVNode"])("br",null,null,-1);function N(e,t,n,o,a,r){var N=Object(i["resolveComponent"])("SaveButton"),y=Object(i["resolveComponent"])("ContentBlock");return Object(i["openBlock"])(),Object(i["createBlock"])(y,{"content-title":e.translate("CoreAdminHome_ArchivingSettings"),anchor:"archivingSettings",class:"matomo-archiving-settings"},{default:Object(i["withCtx"])((function(){return[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("div",l,[Object(i["createElementVNode"])("h3",c,Object(i["toDisplayString"])(e.translate("General_AllowPiwikArchivingToTriggerBrowser")),1),Object(i["createElementVNode"])("div",s,[Object(i["createElementVNode"])("p",null,[Object(i["createElementVNode"])("label",null,[Object(i["withDirectives"])(Object(i["createElementVNode"])("input",{type:"radio",id:"enableBrowserTriggerArchiving1",name:"enableBrowserTriggerArchiving",value:"1","onUpdate:modelValue":t[0]||(t[0]=function(t){return e.enableBrowserTriggerArchivingValue=t})},null,512),[[i["vModelRadio"],e.enableBrowserTriggerArchivingValue]]),Object(i["createElementVNode"])("span",null,Object(i["toDisplayString"])(e.translate("General_Yes")),1),Object(i["createElementVNode"])("span",d,Object(i["toDisplayString"])(e.translate("General_Default")),1)])]),Object(i["createElementVNode"])("p",null,[Object(i["createElementVNode"])("label",m,[Object(i["withDirectives"])(Object(i["createElementVNode"])("input",{type:"radio",id:"enableBrowserTriggerArchiving2",name:"enableBrowserTriggerArchiving",value:"0","onUpdate:modelValue":t[1]||(t[1]=function(t){return e.enableBrowserTriggerArchivingValue=t})},null,512),[[i["vModelRadio"],e.enableBrowserTriggerArchivingValue]]),Object(i["createElementVNode"])("span",null,Object(i["toDisplayString"])(e.translate("General_No")),1),Object(i["createElementVNode"])("span",{class:"form-description",innerHTML:e.archivingTriggerDesc,style:{"margin-left":"4px"}},null,8,u)])])]),Object(i["createElementVNode"])("div",g,[Object(i["createElementVNode"])("div",{class:"form-help",innerHTML:e.archivingInlineHelp},null,8,p)])]),Object(i["createElementVNode"])("div",b,[Object(i["createElementVNode"])("h3",h,Object(i["toDisplayString"])(e.translate("General_ReportsContainingTodayWillBeProcessedAtMostEvery")),1),Object(i["createElementVNode"])("div",v,[Object(i["withDirectives"])(Object(i["createElementVNode"])("input",{type:"text","onUpdate:modelValue":t[2]||(t[2]=function(t){return e.todayArchiveTimeToLiveValue=t}),id:"todayArchiveTimeToLive",disabled:!e.isGeneralSettingsAdminEnabled},null,8,j),[[i["vModelText"],e.todayArchiveTimeToLiveValue]]),Object(i["createElementVNode"])("span",f,Object(i["toDisplayString"])(e.translate("General_RearchiveTimeIntervalOnlyForTodayReports")),1)]),Object(i["createElementVNode"])("div",O,[e.isGeneralSettingsAdminEnabled?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",C,[e.showWarningCron?(Object(i["openBlock"])(),Object(i["createElementBlock"])("strong",k,[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("General_NewReportsWillBeProcessedByCron")),1),V,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_ReportsWillBeProcessedAtMostEveryHour"))+" "+Object(i["toDisplayString"])(e.translate("General_IfArchivingIsFastYouCanSetupCronRunMoreOften")),1),S])):Object(i["createCommentVNode"])("",!0),Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_SmallTrafficYouCanLeaveDefault",e.todayArchiveTimeToLiveDefault))+" ",1),T,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_MediumToHighTrafficItIsRecommendedTo",1800,3600)),1)])):Object(i["createCommentVNode"])("",!0)])]),Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(N,{saving:e.isLoading,onConfirm:t[3]||(t[3]=function(t){return e.save()})},null,8,["saving"])])])]})),_:1},8,["content-title"])}var y=n("a5a2"),A=Object(i["defineComponent"])({props:{enableBrowserTriggerArchiving:Boolean,showSegmentArchiveTriggerInfo:Boolean,isGeneralSettingsAdminEnabled:Boolean,showWarningCron:Boolean,todayArchiveTimeToLive:Number,todayArchiveTimeToLiveDefault:Number},components:{ContentBlock:r["ContentBlock"],SaveButton:y["SaveButton"]},data:function(){return{isLoading:!1,enableBrowserTriggerArchivingValue:this.enableBrowserTriggerArchiving?1:0,todayArchiveTimeToLiveValue:this.todayArchiveTimeToLive}},watch:{enableBrowserTriggerArchiving:function(e){this.enableBrowserTriggerArchivingValue=e?1:0},todayArchiveTimeToLive:function(e){this.todayArchiveTimeToLiveValue=e}},computed:{archivingTriggerDesc:function(){var e="";return e+=Object(r["translate"])("General_ArchivingTriggerDescription",'<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/docs/setup-auto-archiving/">',"</a>"),this.showSegmentArchiveTriggerInfo&&(e+=Object(r["translate"])("General_ArchivingTriggerSegment")),e},archivingInlineHelp:function(){var e=Object(r["translate"])("General_ArchivingInlineHelp");return e+="<br/>",e+=Object(r["translate"])("General_SeeTheOfficialDocumentationForMoreInformation",'<a target="_blank" rel="noreferrer noopener" href="https://matomo.org/docs/setup-auto-archiving/">',"</a>"),e}},methods:{save:function(){var e=this;this.isLoading=!0,r["AjaxHelper"].post({module:"API",method:"CoreAdminHome.setArchiveSettings"},{enableBrowserTriggerArchiving:this.enableBrowserTriggerArchivingValue,todayArchiveTimeToLive:this.todayArchiveTimeToLiveValue}).then((function(){e.isLoading=!1;var t=r["NotificationsStore"].show({message:Object(r["translate"])("CoreAdminHome_SettingsSaveSuccess"),type:"transient",id:"generalSettings",context:"success"});r["NotificationsStore"].scrollToNotification(t)})).finally((function(){e.isLoading=!1}))}}});A.render=N;var w=A,E=(Object(r["createAngularJsAdapter"])({component:w,scope:{enableBrowserTriggerArchiving:{angularJsBind:"<"},showSegmentArchiveTriggerInfo:{angularJsBind:"<"},isGeneralSettingsAdminEnabled:{angularJsBind:"<"},showWarningCron:{angularJsBind:"<"},todayArchiveTimeToLive:{angularJsBind:"<"},todayArchiveTimeToLiveDefault:{angularJsBind:"<"}},directiveName:"matomoArchivingSettings"}),{id:"logoSettings"}),_={id:"logoUploadForm",ref:"logoUploadForm",method:"post",enctype:"multipart/form-data",action:"index.php?module=CoreAdminHome&format=json&action=uploadCustomLogo"},H={key:0},B=["value"],L=Object(i["createElementVNode"])("input",{type:"hidden",name:"force_api_session",value:"1"},null,-1),U={key:0},D={key:0,class:"alert alert-warning uploaderror"},x={class:"row"},I={class:"col s12"},P=["src"],G={class:"row"},F={class:"col s12"},M=["src"],J={key:1},q=["innerHTML"],W={key:1},K={class:"alert alert-warning"}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function Y(e,t,n,o,r,a){var l=Object(i["resolveComponent"])("Field"),c=Object(i["resolveComponent"])("SaveButton"),s=Object(i["resolveComponent"])("ContentBlock"),d=Object(i["resolveDirective"])("form");return Object(i["openBlock"])(),Object(i["createBlock"])(s,{"content-title":e.translate("CoreAdminHome_BrandingSettings"),anchor:"brandingSettings"},{default:Object(i["withCtx"])((function(){return[Object(i["withDirectives"])(Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("p",null,Object(i["toDisplayString"])(e.translate("CoreAdminHome_CustomLogoHelpText")),1),Object(i["createVNode"])(l,{name:"useCustomLogo",uicontrol:"checkbox","model-value":e.enabled,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.onUseCustomLogoChange(t)}),title:e.translate("CoreAdminHome_UseCustomLogo"),"inline-help":e.help},null,8,["model-value","title","inline-help"]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",E,[Object(i["createElementVNode"])("form",L,[e.fileUploadEnabled?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",U,[Object(i["createElementVNode"])("input",{type:"hidden",name:"token_auth",value:e.tokenAuth},null,8,_),F,e.logosWriteable?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",H,[Object(i["createVNode"])(i["Transition"],{name:"fade-out"},{default:Object(i["withCtx"])((function(){return[e.showUploadError?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",k,Object(i["toDisplayString"])(e.translate("CoreAdminHome_LogoUploadFailed")),1)):Object(i["createCommentVNode"])("",!0)]})),_:1}),Object(i["createVNode"])(l,{uicontrol:"file",name:"customLogo","model-value":e.customLogo,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.onCustomLogoChange(t)}),title:e.translate("CoreAdminHome_LogoUpload"),"inline-help":e.translate("CoreAdminHome_LogoUploadHelp","JPG / PNG / GIF","110")},null,8,["model-value","title","inline-help"]),Object(i["createElementVNode"])("div",x,[Object(i["createElementVNode"])("div",G,[Object(i["createElementVNode"])("img",{src:e.pathUserLogoWithBuster,id:"currentLogo",style:{"max-height":"150px"},ref:"currentLogo"},null,8,P)])]),Object(i["createVNode"])(l,{uicontrol:"file",name:"customFavicon","model-value":e.customFavicon,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.onFaviconChange(t)}),title:e.translate("CoreAdminHome_FaviconUpload"),"inline-help":e.translate("CoreAdminHome_LogoUploadHelp","JPG / PNG / GIF","16")},null,8,["model-value","title","inline-help"]),Object(i["createElementVNode"])("div",D,[Object(i["createElementVNode"])("div",M,[Object(i["createElementVNode"])("img",{src:e.pathUserFaviconWithBuster,id:"currentFavicon",width:"16",height:"16",ref:"currentFavicon"},null,8,I)])])])):Object(i["createCommentVNode"])("",!0),e.logosWriteable?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",J,[Object(i["createElementVNode"])("div",{class:"alert alert-warning",innerHTML:e.logosNotWriteableWarning},null,8,q)]))])):Object(i["createCommentVNode"])("",!0),e.fileUploadEnabled?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",W,[Object(i["createElementVNode"])("div",R,Object(i["toDisplayString"])(e.translate("CoreAdminHome_FileUploadDisabled","file_uploads=1")),1)]))],512)],512),[[i["vShow"],e.enabled]]),Object(i["createVNode"])(c,{onConfirm:t[3]||(t[3]=function(t){return e.save()}),saving:e.isLoading},null,8,["saving"])],512),[[d]])]})),_:1},8,["content-title"])}var $=window,z=$.$,K=Object(i["defineComponent"])({props:{fileUploadEnabled:{type:Boolean,required:!0},logosWriteable:{type:Boolean,required:!0},useCustomLogo:{type:Boolean,required:!0},pathUserLogoDirectory:{type:String,required:!0},pathUserLogo:{type:String,required:!0},pathUserLogoSmall:{type:String,required:!0},pathUserLogoSvg:{type:String,required:!0},hasUserLogo:{type:Boolean,required:!0},pathUserFavicon:{type:String,required:!0},hasUserFavicon:{type:Boolean,required:!0},isPluginsAdminEnabled:{type:Boolean,required:!0}},components:{Field:T["Field"],ContentBlock:a["ContentBlock"],SaveButton:T["SaveButton"]},directives:{Form:T["Form"]},data:function(){return{isLoading:!1,enabled:this.useCustomLogo,customLogo:this.pathUserLogo,customFavicon:this.pathUserFavicon,showUploadError:!1,currentLogoSrcExists:this.hasUserLogo,currentFaviconSrcExists:this.hasUserFavicon,currentLogoCacheBuster:(new Date).getTime(),currentFaviconCacheBuster:(new Date).getTime()}},computed:{tokenAuth:function(){return a["Matomo"].token_auth},logosNotWriteableWarning:function(){return Object(a["translate"])("CoreAdminHome_LogoNotWriteableInstruction","<code>".concat(this.pathUserLogoDirectory,"</code><br/>"),"".concat(this.pathUserLogo,", ").concat(this.pathUserLogoSmall,", ").concat(this.pathUserLogoSvg))},help:function(){if(this.isPluginsAdminEnabled){var e='"'.concat(Object(a["translate"])("General_GiveUsYourFeedback"),'"'),t='<a href="?module=CorePluginsAdmin&action=plugins" rel="noreferrer noopener" target="_blank">';return Object(a["translate"])("CoreAdminHome_CustomLogoFeedbackInfo",e,t,"</a>")}},pathUserLogoWithBuster:function(){return this.currentLogoSrcExists&&this.pathUserLogo?"".concat(this.pathUserLogo,"?").concat(this.currentLogoCacheBuster):""},pathUserFaviconWithBuster:function(){return this.currentFaviconSrcExists&&this.pathUserFavicon?"".concat(this.pathUserFavicon,"?").concat(this.currentFaviconCacheBuster):""}},methods:{onUseCustomLogoChange:function(e){this.enabled=e},onCustomLogoChange:function(e){this.customLogo=e,this.updateLogo()},onFaviconChange:function(e){this.customFavicon=e,this.updateLogo()},save:function(){var e=this;this.isLoading=!0,a["AjaxHelper"].post({module:"API",method:"CoreAdminHome.setBrandingSettings"},{useCustomLogo:this.enabled?"1":"0"}).then((function(){var e=a["NotificationsStore"].show({message:Object(a["translate"])("CoreAdminHome_SettingsSaveSuccess"),type:"transient",id:"generalSettings",context:"success"});a["NotificationsStore"].scrollToNotification(e)})).finally((function(){e.isLoading=!1}))},updateLogo:function(){var e=this,t=!!this.customLogo,n=!!this.customFavicon;if(t||n){this.showUploadError=!1;var o="upload".concat((new Date).getTime()),r=z('<iframe name="'.concat(o,'" />'));r.css("display","none"),r.on("load",(function(){setTimeout((function(){var o=(z(r.contents()).find("body").html()||"").trim();"0"===o?e.showUploadError=!0:(t&&(e.currentLogoSrcExists=!0,e.currentLogoCacheBuster=(new Date).getTime()),n&&(e.currentFaviconSrcExists=!0,e.currentFaviconCacheBuster=(new Date).getTime())),"1"!==o&&"0"!==o||r.remove()}),1e3)})),z("body:first").append(r);var a=z(this.$refs.logoUploadForm);a.attr("target",o),a.submit(),this.customLogo="",this.customFavicon=""}}}});K.render=Y;var Q=K,X=(Object(a["createAngularJsAdapter"])({component:Q,scope:{fileUploadEnabled:{angularJsBind:"<"},logosWriteable:{angularJsBind:"<"},useCustomLogo:{angularJsBind:"<"},pathUserLogoDirectory:{angularJsBind:"<"},pathUserLogo:{angularJsBind:"<"},pathUserLogoSmall:{angularJsBind:"<"},pathUserLogoSvg:{angularJsBind:"<"},hasUserLogo:{angularJsBind:"<"},pathUserFavicon:{angularJsBind:"<"},hasUserFavicon:{angularJsBind:"<"},isPluginsAdminEnabled:{angularJsBind:"<"}},directiveName:"matomoBrandingSettings"}),{id:"smtpSettings"}); + */function R(e,t,n,o,a,r){var l=Object(i["resolveComponent"])("Field"),c=Object(i["resolveComponent"])("SaveButton"),s=Object(i["resolveComponent"])("ContentBlock"),d=Object(i["resolveDirective"])("form");return Object(i["openBlock"])(),Object(i["createBlock"])(s,{"content-title":e.translate("CoreAdminHome_BrandingSettings"),anchor:"brandingSettings"},{default:Object(i["withCtx"])((function(){return[Object(i["withDirectives"])(Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("p",null,Object(i["toDisplayString"])(e.translate("CoreAdminHome_CustomLogoHelpText")),1),Object(i["createVNode"])(l,{name:"useCustomLogo",uicontrol:"checkbox","model-value":e.enabled,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.onUseCustomLogoChange(t)}),title:e.translate("CoreAdminHome_UseCustomLogo"),"inline-help":e.help},null,8,["model-value","title","inline-help"]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",E,[Object(i["createElementVNode"])("form",_,[e.fileUploadEnabled?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",H,[Object(i["createElementVNode"])("input",{type:"hidden",name:"token_auth",value:e.tokenAuth},null,8,B),L,e.logosWriteable?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",U,[Object(i["createVNode"])(i["Transition"],{name:"fade-out"},{default:Object(i["withCtx"])((function(){return[e.showUploadError?(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",D,Object(i["toDisplayString"])(e.translate("CoreAdminHome_LogoUploadFailed")),1)):Object(i["createCommentVNode"])("",!0)]})),_:1}),Object(i["createVNode"])(l,{uicontrol:"file",name:"customLogo","model-value":e.customLogo,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.onCustomLogoChange(t)}),title:e.translate("CoreAdminHome_LogoUpload"),"inline-help":e.translate("CoreAdminHome_LogoUploadHelp","JPG / PNG / GIF","110")},null,8,["model-value","title","inline-help"]),Object(i["createElementVNode"])("div",x,[Object(i["createElementVNode"])("div",I,[Object(i["createElementVNode"])("img",{src:e.pathUserLogoWithBuster,id:"currentLogo",style:{"max-height":"150px"},ref:"currentLogo"},null,8,P)])]),Object(i["createVNode"])(l,{uicontrol:"file",name:"customFavicon","model-value":e.customFavicon,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.onFaviconChange(t)}),title:e.translate("CoreAdminHome_FaviconUpload"),"inline-help":e.translate("CoreAdminHome_LogoUploadHelp","JPG / PNG / GIF","16")},null,8,["model-value","title","inline-help"]),Object(i["createElementVNode"])("div",G,[Object(i["createElementVNode"])("div",F,[Object(i["createElementVNode"])("img",{src:e.pathUserFaviconWithBuster,id:"currentFavicon",width:"16",height:"16",ref:"currentFavicon"},null,8,M)])])])):Object(i["createCommentVNode"])("",!0),e.logosWriteable?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",J,[Object(i["createElementVNode"])("div",{class:"alert alert-warning",innerHTML:e.logosNotWriteableWarning},null,8,q)]))])):Object(i["createCommentVNode"])("",!0),e.fileUploadEnabled?Object(i["createCommentVNode"])("",!0):(Object(i["openBlock"])(),Object(i["createElementBlock"])("div",W,[Object(i["createElementVNode"])("div",K,Object(i["toDisplayString"])(e.translate("CoreAdminHome_FileUploadDisabled","file_uploads=1")),1)]))],512)],512),[[i["vShow"],e.enabled]]),Object(i["createVNode"])(c,{onConfirm:t[3]||(t[3]=function(t){return e.save()}),saving:e.isLoading},null,8,["saving"])],512),[[d]])]})),_:1},8,["content-title"])}var Q=window,$=Q.$,Y=Object(i["defineComponent"])({props:{fileUploadEnabled:{type:Boolean,required:!0},logosWriteable:{type:Boolean,required:!0},useCustomLogo:{type:Boolean,required:!0},pathUserLogoDirectory:{type:String,required:!0},pathUserLogo:{type:String,required:!0},pathUserLogoSmall:{type:String,required:!0},pathUserLogoSvg:{type:String,required:!0},hasUserLogo:{type:Boolean,required:!0},pathUserFavicon:{type:String,required:!0},hasUserFavicon:{type:Boolean,required:!0},isPluginsAdminEnabled:{type:Boolean,required:!0}},components:{Field:y["Field"],ContentBlock:r["ContentBlock"],SaveButton:y["SaveButton"]},directives:{Form:y["Form"]},data:function(){return{isLoading:!1,enabled:this.useCustomLogo,customLogo:this.pathUserLogo,customFavicon:this.pathUserFavicon,showUploadError:!1,currentLogoSrcExists:this.hasUserLogo,currentFaviconSrcExists:this.hasUserFavicon,currentLogoCacheBuster:(new Date).getTime(),currentFaviconCacheBuster:(new Date).getTime()}},computed:{tokenAuth:function(){return r["Matomo"].token_auth},logosNotWriteableWarning:function(){return Object(r["translate"])("CoreAdminHome_LogoNotWriteableInstruction","<code>".concat(this.pathUserLogoDirectory,"</code><br/>"),"".concat(this.pathUserLogo,", ").concat(this.pathUserLogoSmall,", ").concat(this.pathUserLogoSvg))},help:function(){if(this.isPluginsAdminEnabled){var e='"'.concat(Object(r["translate"])("General_GiveUsYourFeedback"),'"'),t='<a href="?module=CorePluginsAdmin&action=plugins" rel="noreferrer noopener" target="_blank">';return Object(r["translate"])("CoreAdminHome_CustomLogoFeedbackInfo",e,t,"</a>")}},pathUserLogoWithBuster:function(){return this.currentLogoSrcExists&&this.pathUserLogo?"".concat(this.pathUserLogo,"?").concat(this.currentLogoCacheBuster):""},pathUserFaviconWithBuster:function(){return this.currentFaviconSrcExists&&this.pathUserFavicon?"".concat(this.pathUserFavicon,"?").concat(this.currentFaviconCacheBuster):""}},methods:{onUseCustomLogoChange:function(e){this.enabled=e},onCustomLogoChange:function(e){this.customLogo=e,this.updateLogo()},onFaviconChange:function(e){this.customFavicon=e,this.updateLogo()},save:function(){var e=this;this.isLoading=!0,r["AjaxHelper"].post({module:"API",method:"CoreAdminHome.setBrandingSettings"},{useCustomLogo:this.enabled?"1":"0"}).then((function(){var e=r["NotificationsStore"].show({message:Object(r["translate"])("CoreAdminHome_SettingsSaveSuccess"),type:"transient",id:"generalSettings",context:"success"});r["NotificationsStore"].scrollToNotification(e)})).finally((function(){e.isLoading=!1}))},updateLogo:function(){var e=this,t=!!this.customLogo,n=!!this.customFavicon;if(t||n){this.showUploadError=!1;var o="upload".concat((new Date).getTime()),a=$('<iframe name="'.concat(o,'" />'));a.css("display","none"),a.on("load",(function(){setTimeout((function(){var o=($(a.contents()).find("body").html()||"").trim();"0"===o?e.showUploadError=!0:(t&&(e.currentLogoSrcExists=!0,e.currentLogoCacheBuster=(new Date).getTime()),n&&(e.currentFaviconSrcExists=!0,e.currentFaviconCacheBuster=(new Date).getTime())),"1"!==o&&"0"!==o||a.remove()}),1e3)})),$("body:first").append(a);var r=$(this.$refs.logoUploadForm);r.attr("target",o),r.submit(),this.customLogo="",this.customFavicon=""}}}});Y.render=R;var z=Y,X=(Object(r["createAngularJsAdapter"])({component:z,scope:{fileUploadEnabled:{angularJsBind:"<"},logosWriteable:{angularJsBind:"<"},useCustomLogo:{angularJsBind:"<"},pathUserLogoDirectory:{angularJsBind:"<"},pathUserLogo:{angularJsBind:"<"},pathUserLogoSmall:{angularJsBind:"<"},pathUserLogoSvg:{angularJsBind:"<"},hasUserLogo:{angularJsBind:"<"},pathUserFavicon:{angularJsBind:"<"},hasUserFavicon:{angularJsBind:"<"},isPluginsAdminEnabled:{angularJsBind:"<"}},directiveName:"matomoBrandingSettings"}),{id:"smtpSettings"}); /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function Z(e,t,n,o,r,a){var l=Object(i["resolveComponent"])("Field"),c=Object(i["resolveComponent"])("SaveButton"),s=Object(i["resolveComponent"])("ContentBlock"),d=Object(i["resolveDirective"])("form");return Object(i["openBlock"])(),Object(i["createBlock"])(s,{"content-title":e.translate("CoreAdminHome_EmailServerSettings"),anchor:"mailSettings"},{default:Object(i["withCtx"])((function(){return[Object(i["withDirectives"])(Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"mailUseSmtp",modelValue:e.enabled,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.enabled=t}),title:e.translate("General_UseSMTPServerForEmail"),"inline-help":e.translate("General_SelectYesIfYouWantToSendEmailsViaServer")},null,8,["modelValue","title","inline-help"]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",X,[Object(i["createVNode"])(l,{uicontrol:"text",name:"mailHost","model-value":e.mailHost,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.onUpdateMailHost(t)}),title:e.translate("General_SmtpServerAddress")},null,8,["model-value","title"]),Object(i["createVNode"])(l,{uicontrol:"text",name:"mailPort",modelValue:e.mailPort,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.mailPort=t}),title:e.translate("General_SmtpPort"),"inline-help":e.translate("General_OptionalSmtpPort")},null,8,["modelValue","title","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"select",name:"mailType",modelValue:e.mailType,"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.mailType=t}),title:e.translate("General_AuthenticationMethodSmtp"),options:e.mailTypes,"inline-help":e.translate("General_OnlyUsedIfUserPwdIsSet")},null,8,["modelValue","title","options","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"text",name:"mailUsername",modelValue:e.mailUsername,"onUpdate:modelValue":t[4]||(t[4]=function(t){return e.mailUsername=t}),title:e.translate("General_SmtpUsername"),"inline-help":e.translate("General_OnlyEnterIfRequired"),autocomplete:!1},null,8,["modelValue","title","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"password",name:"mailPassword","model-value":e.mailPassword,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.onMailPasswordChange(t)}),onClick:t[6]||(t[6]=function(t){!e.passwordChanged&&t.target.select()}),title:e.translate("General_SmtpPassword"),"inline-help":e.passwordHelp,autocomplete:!1},null,8,["model-value","title","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"text",name:"mailFromAddress",modelValue:e.mailFromAddress,"onUpdate:modelValue":t[7]||(t[7]=function(t){return e.mailFromAddress=t}),title:e.translate("General_SmtpFromAddress"),"inline-help":e.translate("General_SmtpFromEmailHelp",e.mailHost),autocomplete:!1},null,8,["modelValue","title","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"text",name:"mailFromName",modelValue:e.mailFromName,"onUpdate:modelValue":t[8]||(t[8]=function(t){return e.mailFromName=t}),title:e.translate("General_SmtpFromName"),"inline-help":e.translate("General_NameShownInTheSenderColumn"),autocomplete:!1},null,8,["modelValue","title","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"select",name:"mailEncryption",modelValue:e.mailEncryption,"onUpdate:modelValue":t[9]||(t[9]=function(t){return e.mailEncryption=t}),title:e.translate("General_SmtpEncryption"),options:e.mailEncryptions,"inline-help":e.translate("General_EncryptedSmtpTransport")},null,8,["modelValue","title","options","inline-help"])],512),[[i["vShow"],e.enabled]]),Object(i["createVNode"])(c,{onConfirm:t[10]||(t[10]=function(t){return e.save()}),saving:e.isLoading},null,8,["saving"])],512),[[d]])]})),_:1},8,["content-title"])}var ee=Object(i["defineComponent"])({props:{mail:{type:Object,required:!0},mailTypes:{type:Object,required:!0},mailEncryptions:{type:Object,required:!0}},data:function(){var e=this.mail;return{isLoading:!1,enabled:"smtp"===e.transport,mailHost:e.host,passwordChanged:!1,mailPort:e.port,mailType:e.type,mailUsername:e.username,mailPassword:e.password?"******":"",mailFromAddress:e.noreply_email_address,mailFromName:e.noreply_email_name,mailEncryption:e.encryption}},components:{ContentBlock:a["ContentBlock"],Field:T["Field"],SaveButton:T["SaveButton"]},directives:{Form:T["Form"]},computed:{passwordHelp:function(){var e="".concat(Object(a["translate"])("General_OnlyEnterIfRequiredPassword"),"<br/>"),t="".concat(Object(a["translate"])("General_WarningPasswordStored","<strong>","</strong>"),"<br/>");return"".concat(e,"\n").concat(t)}},methods:{onUpdateMailHost:function(e){this.mailHost=e,this.passwordChanged||(this.mailPassword="",this.passwordChanged=!0)},onMailPasswordChange:function(e){this.mailPassword=e,this.passwordChanged=!0},save:function(){var e=this;this.isLoading=!0;var t={mailUseSmtp:this.enabled?"1":"0",mailPort:this.mailPort,mailHost:this.mailHost,mailType:this.mailType,mailUsername:this.mailUsername,mailFromAddress:this.mailFromAddress,mailFromName:this.mailFromName,mailEncryption:this.mailEncryption};this.passwordChanged&&(t.mailPassword=this.mailPassword),a["AjaxHelper"].post({module:"CoreAdminHome",action:"setMailSettings"},t,{withTokenInUrl:!0}).then((function(){var e=a["NotificationsStore"].show({message:Object(a["translate"])("CoreAdminHome_SettingsSaveSuccess"),type:"transient",id:"generalSettings",context:"success"});a["NotificationsStore"].scrollToNotification(e)})).finally((function(){e.isLoading=!1}))}}});ee.render=Z;var te=ee; + */function Z(e,t,n,o,a,r){var l=Object(i["resolveComponent"])("Field"),c=Object(i["resolveComponent"])("SaveButton"),s=Object(i["resolveComponent"])("ContentBlock"),d=Object(i["resolveDirective"])("form");return Object(i["openBlock"])(),Object(i["createBlock"])(s,{"content-title":e.translate("CoreAdminHome_EmailServerSettings"),anchor:"mailSettings"},{default:Object(i["withCtx"])((function(){return[Object(i["withDirectives"])(Object(i["createElementVNode"])("div",null,[Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"mailUseSmtp",modelValue:e.enabled,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.enabled=t}),title:e.translate("General_UseSMTPServerForEmail"),"inline-help":e.translate("General_SelectYesIfYouWantToSendEmailsViaServer")},null,8,["modelValue","title","inline-help"]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",X,[Object(i["createVNode"])(l,{uicontrol:"text",name:"mailHost","model-value":e.mailHost,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.onUpdateMailHost(t)}),title:e.translate("General_SmtpServerAddress")},null,8,["model-value","title"]),Object(i["createVNode"])(l,{uicontrol:"text",name:"mailPort",modelValue:e.mailPort,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.mailPort=t}),title:e.translate("General_SmtpPort"),"inline-help":e.translate("General_OptionalSmtpPort")},null,8,["modelValue","title","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"select",name:"mailType",modelValue:e.mailType,"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.mailType=t}),title:e.translate("General_AuthenticationMethodSmtp"),options:e.mailTypes,"inline-help":e.translate("General_OnlyUsedIfUserPwdIsSet")},null,8,["modelValue","title","options","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"text",name:"mailUsername",modelValue:e.mailUsername,"onUpdate:modelValue":t[4]||(t[4]=function(t){return e.mailUsername=t}),title:e.translate("General_SmtpUsername"),"inline-help":e.translate("General_OnlyEnterIfRequired"),autocomplete:!1},null,8,["modelValue","title","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"password",name:"mailPassword","model-value":e.mailPassword,"onUpdate:modelValue":t[5]||(t[5]=function(t){return e.onMailPasswordChange(t)}),onClick:t[6]||(t[6]=function(t){!e.passwordChanged&&t.target.select()}),title:e.translate("General_SmtpPassword"),"inline-help":e.passwordHelp,autocomplete:!1},null,8,["model-value","title","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"text",name:"mailFromAddress",modelValue:e.mailFromAddress,"onUpdate:modelValue":t[7]||(t[7]=function(t){return e.mailFromAddress=t}),title:e.translate("General_SmtpFromAddress"),"inline-help":e.translate("General_SmtpFromEmailHelp",e.mailHost),autocomplete:!1},null,8,["modelValue","title","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"text",name:"mailFromName",modelValue:e.mailFromName,"onUpdate:modelValue":t[8]||(t[8]=function(t){return e.mailFromName=t}),title:e.translate("General_SmtpFromName"),"inline-help":e.translate("General_NameShownInTheSenderColumn"),autocomplete:!1},null,8,["modelValue","title","inline-help"]),Object(i["createVNode"])(l,{uicontrol:"select",name:"mailEncryption",modelValue:e.mailEncryption,"onUpdate:modelValue":t[9]||(t[9]=function(t){return e.mailEncryption=t}),title:e.translate("General_SmtpEncryption"),options:e.mailEncryptions,"inline-help":e.translate("General_EncryptedSmtpTransport")},null,8,["modelValue","title","options","inline-help"])],512),[[i["vShow"],e.enabled]]),Object(i["createVNode"])(c,{onConfirm:t[10]||(t[10]=function(t){return e.save()}),saving:e.isLoading},null,8,["saving"])],512),[[d]])]})),_:1},8,["content-title"])}var ee=Object(i["defineComponent"])({props:{mail:{type:Object,required:!0},mailTypes:{type:Object,required:!0},mailEncryptions:{type:Object,required:!0}},data:function(){var e=this.mail;return{isLoading:!1,enabled:"smtp"===e.transport,mailHost:e.host,passwordChanged:!1,mailPort:e.port,mailType:e.type,mailUsername:e.username,mailPassword:e.password?"******":"",mailFromAddress:e.noreply_email_address,mailFromName:e.noreply_email_name,mailEncryption:e.encryption}},components:{ContentBlock:r["ContentBlock"],Field:y["Field"],SaveButton:y["SaveButton"]},directives:{Form:y["Form"]},computed:{passwordHelp:function(){var e="".concat(Object(r["translate"])("General_OnlyEnterIfRequiredPassword"),"<br/>"),t="".concat(Object(r["translate"])("General_WarningPasswordStored","<strong>","</strong>"),"<br/>");return"".concat(e,"\n").concat(t)}},methods:{onUpdateMailHost:function(e){this.mailHost=e,this.passwordChanged||(this.mailPassword="",this.passwordChanged=!0)},onMailPasswordChange:function(e){this.mailPassword=e,this.passwordChanged=!0},save:function(){var e=this;this.isLoading=!0;var t={mailUseSmtp:this.enabled?"1":"0",mailPort:this.mailPort,mailHost:this.mailHost,mailType:this.mailType,mailUsername:this.mailUsername,mailFromAddress:this.mailFromAddress,mailFromName:this.mailFromName,mailEncryption:this.mailEncryption};this.passwordChanged&&(t.mailPassword=this.mailPassword),r["AjaxHelper"].post({module:"CoreAdminHome",action:"setMailSettings"},t,{withTokenInUrl:!0}).then((function(){var e=r["NotificationsStore"].show({message:Object(r["translate"])("CoreAdminHome_SettingsSaveSuccess"),type:"transient",id:"generalSettings",context:"success"});r["NotificationsStore"].scrollToNotification(e)})).finally((function(){e.isLoading=!1}))}}});ee.render=Z;var te=ee,ne=(Object(r["createAngularJsAdapter"])({component:te,scope:{mail:{angularJsBind:"<"},mailTypes:{angularJsBind:"<"},mailEncryptions:{angularJsBind:"<"}},directiveName:"matomoSmtpSettings"}),{id:"js-code-options"}),oe=Object(i["createElementVNode"])("br",null,null,-1),ae=Object(i["createElementVNode"])("br",null,null,-1),re=["innerHTML"],ie=["innerHTML"],le=Object(i["createElementVNode"])("br",null,null,-1),ce=Object(i["createElementVNode"])("br",null,null,-1),se=["innerHTML"],de=Object(i["createElementVNode"])("br",null,null,-1),me=Object(i["createElementVNode"])("br",null,null,-1),ue=["innerHTML"],ge=Object(i["createElementVNode"])("br",null,null,-1),pe=Object(i["createElementVNode"])("br",null,null,-1),be=Object(i["createElementVNode"])("a",{href:"https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-wordpress/",target:"_blank",rel:"noopener"},"WordPress",-1),he=Object(i["createTextVNode"])(" | "),ve=Object(i["createElementVNode"])("a",{href:"https://matomo.org/faq/new-to-piwik/how-do-i-integrate-matomo-with-squarespace-website/",target:"_blank",rel:"noopener"},"Squarespace",-1),je=Object(i["createTextVNode"])(" | "),fe=Object(i["createElementVNode"])("a",{href:"https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-analytics-tracking-code-on-wix/",target:"_blank",rel:"noopener"},"Wix",-1),Oe=Object(i["createTextVNode"])(" | "),Ce=Object(i["createElementVNode"])("a",{href:"https://matomo.org/faq/how-to-install/faq_19424/",target:"_blank",rel:"noopener"},"SharePoint",-1),ke=Object(i["createTextVNode"])(" | "),Ve=Object(i["createElementVNode"])("a",{href:"https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-analytics-tracking-code-on-joomla/",target:"_blank",rel:"noopener"},"Joomla",-1),Se=Object(i["createTextVNode"])(" | "),Te=Object(i["createElementVNode"])("a",{href:"https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-my-shopify-store/",target:"_blank",rel:"noopener"},"Shopify",-1),Ne=Object(i["createTextVNode"])(" | "),ye=Object(i["createElementVNode"])("a",{href:"https://matomo.org/faq/new-to-piwik/how-do-i-use-matomo-analytics-within-gtm-google-tag-manager/",target:"_blank",rel:"noopener"},"Google Tag Manager",-1),Ae={id:"javascript-output-section"},we={class:"valign-wrapper trackingHelpHeader matchWidth"},Ee={id:"javascript-text"},_e=["textContent"],He={id:"optional-js-tracking-options"},Be={id:"jsTrackAllSubdomainsInlineHelp",class:"inline-help-node"},Le=["innerHTML"],Ue=["innerHTML"],De={id:"jsTrackGroupByDomainInlineHelp",class:"inline-help-node"},xe={id:"jsTrackAllAliasesInlineHelp",class:"inline-help-node"},Ie={id:"javascript-advanced-options"},Pe={id:"javascript-tracking-visitor-cv"},Ge={class:"row"},Fe={class:"col s12 m3"},Me={class:"col s12 m3"},Je={class:"col s12 m6 l3"},qe=["onKeydown"],We={class:"col s12 m6 l3"},Ke=["onKeydown"],Re={class:"row"},Qe={class:"col s12"},$e=Object(i["createElementVNode"])("span",{class:"icon-add"},null,-1),Ye={id:"jsCrossDomain",class:"inline-help-node"},ze=Object(i["createElementVNode"])("br",null,null,-1),Xe={id:"jsDoNotTrackInlineHelp",class:"inline-help-node"},Ze={key:0},et=Object(i["createElementVNode"])("br",null,null,-1),tt=["innerHTML"],nt={id:"js-campaign-query-param-extra"},ot={class:"row"},at={class:"col s12"},rt={class:"row"},it={class:"col s12"}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */Object(a["createAngularJsAdapter"])({component:te,scope:{mail:{angularJsBind:"<"},mailTypes:{angularJsBind:"<"},mailEncryptions:{angularJsBind:"<"}},directiveName:"matomoSmtpSettings"})}})})); + */function lt(e,t,n,o,a,r){var l=Object(i["resolveComponent"])("Field"),c=Object(i["resolveComponent"])("ContentBlock"),s=Object(i["resolveDirective"])("select-on-focus");return Object(i["openBlock"])(),Object(i["createBlock"])(c,{anchor:"javaScriptTracking","content-title":e.translate("CoreAdminHome_JavaScriptTracking")},{default:Object(i["withCtx"])((function(){return[Object(i["createElementVNode"])("div",ne,[Object(i["createElementVNode"])("p",null,[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("CoreAdminHome_JSTrackingIntro1"))+" ",1),oe,ae,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("CoreAdminHome_JSTrackingIntro2"))+" ",1),Object(i["createElementVNode"])("span",{innerHTML:e.jsTrackingIntro3a},null,8,re),Object(i["createElementVNode"])("span",{innerHTML:" "+e.jsTrackingIntro3b},null,8,ie),le,ce,Object(i["createElementVNode"])("span",{innerHTML:e.jsTrackingIntro4a},null,8,se),de,me,Object(i["createElementVNode"])("span",{innerHTML:e.jsTrackingIntro5},null,8,ue),ge,pe,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("SitesManager_InstallationGuides"))+" : ",1),be,he,ve,je,fe,Oe,Ce,ke,Ve,Se,Te,Ne,ye]),Object(i["createVNode"])(l,{uicontrol:"site",name:"js-tracker-website",class:"jsTrackingCodeWebsite",modelValue:e.site,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.site=t}),introduction:e.translate("General_Website")},null,8,["modelValue","introduction"]),Object(i["createElementVNode"])("div",Ae,[Object(i["createElementVNode"])("div",we,[Object(i["createElementVNode"])("div",null,[Object(i["createElementVNode"])("h3",null,Object(i["toDisplayString"])(e.translate("General_JsTrackingTag")),1),Object(i["createElementVNode"])("p",null,Object(i["toDisplayString"])(e.translate("CoreAdminHome_JSTracking_CodeNoteBeforeClosingHead","</head>")),1)]),Object(i["createElementVNode"])("button",{class:"btn",id:"emailJsBtn",onClick:t[1]||(t[1]=function(t){return e.sendEmail()})},Object(i["toDisplayString"])(e.translate("SitesManager_EmailInstructionsButton")),1)]),Object(i["createElementVNode"])("div",Ee,[Object(i["withDirectives"])(Object(i["createElementVNode"])("pre",{class:"codeblock",textContent:Object(i["toDisplayString"])(e.trackingCode),ref:"trackingCode"},null,8,_e),[[s,{}]])])]),Object(i["createElementVNode"])("div",He,[Object(i["createElementVNode"])("div",Be,[Object(i["createElementVNode"])("span",{innerHTML:e.mergeSubdomainsDesc},null,8,Le),Object(i["createElementVNode"])("span",{innerHTML:e.learnMoreText},null,8,Ue)]),Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"javascript-tracking-all-subdomains","model-value":e.trackAllSubdomains,"onUpdate:modelValue":t[2]||(t[2]=function(t){e.trackAllSubdomains=t,e.updateTrackingCode()}),disabled:e.isLoading,introduction:e.translate("General_Options"),title:"".concat(e.translate("CoreAdminHome_JSTracking_MergeSubdomains")," ").concat(e.currentSiteName),"inline-help":"#jsTrackAllSubdomainsInlineHelp"},null,8,["model-value","disabled","introduction","title"])]),Object(i["createElementVNode"])("div",De,Object(i["toDisplayString"])(e.translate("CoreAdminHome_JSTracking_GroupPageTitlesByDomainDesc1",e.currentSiteHost)),1),Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"javascript-tracking-group-by-domain","model-value":e.groupByDomain,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.groupByDomain=t,e.updateTrackingCode()}),disabled:e.isLoading,title:e.translate("CoreAdminHome_JSTracking_GroupPageTitlesByDomain"),"inline-help":"#jsTrackGroupByDomainInlineHelp"},null,8,["model-value","disabled","title"]),Object(i["createElementVNode"])("div",xe,Object(i["toDisplayString"])(e.translate("CoreAdminHome_JSTracking_MergeAliasesDesc",e.currentSiteAlias)),1),Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"javascript-tracking-all-aliases","model-value":e.trackAllAliases,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.trackAllAliases=t,e.updateTrackingCode()}),disabled:e.isLoading,title:"".concat(e.translate("CoreAdminHome_JSTracking_MergeAliases")," ").concat(e.currentSiteName),"inline-help":"#jsTrackAllAliasesInlineHelp"},null,8,["model-value","disabled","title"])]),Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"javascript-tracking-noscript","model-value":e.trackNoScript,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.trackNoScript=t,e.updateTrackingCode()}),disabled:e.isLoading,title:e.translate("CoreAdminHome_JSTracking_TrackNoScript")},null,8,["model-value","disabled","title"]),Object(i["createElementVNode"])("h3",null,Object(i["toDisplayString"])(e.translate("Mobile_Advanced")),1),Object(i["createElementVNode"])("p",null,[Object(i["withDirectives"])(Object(i["createElementVNode"])("a",{href:"javascript:;",onClick:t[6]||(t[6]=Object(i["withModifiers"])((function(t){return e.showAdvanced=!0}),["prevent"]))},Object(i["toDisplayString"])(e.translate("General_Show")),513),[[i["vShow"],!e.showAdvanced]]),Object(i["withDirectives"])(Object(i["createElementVNode"])("a",{href:"javascript:;",onClick:t[7]||(t[7]=Object(i["withModifiers"])((function(t){return e.showAdvanced=!1}),["prevent"]))},Object(i["toDisplayString"])(e.translate("General_Hide")),513),[[i["vShow"],e.showAdvanced]])]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",Ie,[Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"javascript-tracking-visitor-cv-check","model-value":e.trackCustomVars,"onUpdate:modelValue":t[8]||(t[8]=function(t){e.trackCustomVars=t,e.updateTrackingCode()}),disabled:e.isLoading,title:e.translate("CoreAdminHome_JSTracking_VisitorCustomVars"),"inline-help":e.translate("CoreAdminHome_JSTracking_VisitorCustomVarsDesc")},null,8,["model-value","disabled","title","inline-help"]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",Pe,[Object(i["createElementVNode"])("div",Ge,[Object(i["createElementVNode"])("div",Fe,Object(i["toDisplayString"])(e.translate("General_Name")),1),Object(i["createElementVNode"])("div",Me,Object(i["toDisplayString"])(e.translate("General_Value")),1)]),(Object(i["openBlock"])(!0),Object(i["createElementBlock"])(i["Fragment"],null,Object(i["renderList"])(e.customVars,(function(t,n){return Object(i["openBlock"])(),Object(i["createElementBlock"])("div",{class:"row",key:n},[Object(i["createElementVNode"])("div",Je,[Object(i["createElementVNode"])("input",{type:"text",class:"custom-variable-name",onKeydown:function(t){return e.onCustomVarNameKeydown(t,n)},placeholder:"e.g. Type"},null,40,qe)]),Object(i["createElementVNode"])("div",We,[Object(i["createElementVNode"])("input",{type:"text",class:"custom-variable-value",onKeydown:function(t){return e.onCustomVarValueKeydown(t,n)},placeholder:"e.g. Customer"},null,40,Ke)])])})),128)),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",Re,[Object(i["createElementVNode"])("div",Qe,[Object(i["createElementVNode"])("a",{href:"javascript:;",onClick:t[9]||(t[9]=function(t){return e.addCustomVar()}),class:"add-custom-variable"},[$e,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("General_Add")),1)])])],512),[[i["vShow"],e.canAddMoreCustomVariables]])],512),[[i["vShow"],e.trackCustomVars]]),Object(i["createElementVNode"])("div",Ye,[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("CoreAdminHome_JSTracking_CrossDomain"))+" ",1),ze,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("CoreAdminHome_JSTracking_CrossDomain_NeedsMultipleDomains")),1)]),Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"javascript-tracking-cross-domain","model-value":e.crossDomain,"onUpdate:modelValue":t[10]||(t[10]=function(t){e.crossDomain=t,e.updateTrackingCode(),e.onCrossDomainToggle()}),disabled:e.isLoading||!e.hasManySiteUrls,title:e.translate("CoreAdminHome_JSTracking_EnableCrossDomainLinking"),"inline-help":"#jsCrossDomain"},null,8,["model-value","disabled","title"]),Object(i["createElementVNode"])("div",Xe,[Object(i["createTextVNode"])(Object(i["toDisplayString"])(e.translate("CoreAdminHome_JSTracking_EnableDoNotTrackDesc"))+" ",1),e.serverSideDoNotTrackEnabled?(Object(i["openBlock"])(),Object(i["createElementBlock"])("span",Ze,[et,Object(i["createTextVNode"])(" "+Object(i["toDisplayString"])(e.translate("CoreAdminHome_JSTracking_EnableDoNotTrack_AlreadyEnabled")),1)])):Object(i["createCommentVNode"])("",!0)]),Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"javascript-tracking-do-not-track","model-value":e.doNotTrack,"onUpdate:modelValue":t[11]||(t[11]=function(t){e.doNotTrack=t,e.updateTrackingCode()}),disabled:e.isLoading,title:e.translate("CoreAdminHome_JSTracking_EnableDoNotTrack"),"inline-help":"#jsDoNotTrackInlineHelp"},null,8,["model-value","disabled","title"]),Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"javascript-tracking-disable-cookies","model-value":e.disableCookies,"onUpdate:modelValue":t[12]||(t[12]=function(t){e.disableCookies=t,e.updateTrackingCode()}),disabled:e.isLoading,title:e.translate("CoreAdminHome_JSTracking_DisableCookies"),"inline-help":e.translate("CoreAdminHome_JSTracking_DisableCookiesDesc")},null,8,["model-value","disabled","title","inline-help"]),Object(i["createElementVNode"])("div",{id:"jsTrackCampaignParamsInlineHelp",class:"inline-help-node",innerHTML:e.jsTrackCampaignParamsInlineHelp},null,8,tt),Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"custom-campaign-query-params-check","model-value":e.useCustomCampaignParams,"onUpdate:modelValue":t[13]||(t[13]=function(t){e.useCustomCampaignParams=t,e.updateTrackingCode()}),disabled:e.isLoading,title:e.translate("CoreAdminHome_JSTracking_CustomCampaignQueryParam"),"inline-help":"#jsTrackCampaignParamsInlineHelp"},null,8,["model-value","disabled","title"]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",nt,[Object(i["createElementVNode"])("div",ot,[Object(i["createElementVNode"])("div",at,[Object(i["createVNode"])(l,{uicontrol:"text",name:"custom-campaign-name-query-param","model-value":e.customCampaignName,"onUpdate:modelValue":t[14]||(t[14]=function(t){e.customCampaignName=t,e.updateTrackingCode()}),disabled:e.isLoading,title:e.translate("CoreAdminHome_JSTracking_CampaignNameParam")},null,8,["model-value","disabled","title"])])]),Object(i["createElementVNode"])("div",rt,[Object(i["createElementVNode"])("div",it,[Object(i["createVNode"])(l,{uicontrol:"text",name:"custom-campaign-keyword-query-param","model-value":e.customCampaignKeyword,"onUpdate:modelValue":t[15]||(t[15]=function(t){e.customCampaignKeyword=t,e.updateTrackingCode()}),disabled:e.isLoading,title:e.translate("CoreAdminHome_JSTracking_CampaignKwdParam")},null,8,["model-value","disabled","title"])])])],512),[[i["vShow"],e.useCustomCampaignParams]])],512),[[i["vShow"],e.showAdvanced]])]})),_:1},8,["content-title"])}function ct(e){var t=new URL(e);return t.hostname}function st(e){return e.map((function(e){return[e.name,e.value]}))}var dt=window,mt=dt.$,ut=window.location.host,gt=window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/")),pt=Object(i["defineComponent"])({props:{defaultSite:{type:Object,required:!0},maxCustomVariables:Number,serverSideDoNotTrackEnabled:Boolean},data:function(){return{showAdvanced:!1,site:this.defaultSite,trackingCode:"",trackAllSubdomains:!1,isLoading:!1,siteUrls:{},siteExcludedQueryParams:{},crossDomain:!1,groupByDomain:!1,trackAllAliases:!1,trackNoScript:!1,trackCustomVars:!1,customVars:[],canAddMoreCustomVariables:!!this.maxCustomVariables&&this.maxCustomVariables>0,doNotTrack:!1,disableCookies:!1,useCustomCampaignParams:!1,customCampaignName:"",customCampaignKeyword:"",trackingCodeAbortController:null,isHighlighting:!1}},components:{ContentBlock:r["ContentBlock"],Field:y["Field"]},directives:{SelectOnFocus:r["SelectOnFocus"]},created:function(){this.onCustomVarNameKeydown=Object(r["debounce"])(this.onCustomVarNameKeydown,100),this.onCustomVarValueKeydown=Object(r["debounce"])(this.onCustomVarValueKeydown,100),this.addCustomVar(),this.site&&this.site.id&&this.onSiteChanged(this.site)},watch:{site:function(e){this.onSiteChanged(e)}},methods:{onSiteChanged:function(e){var t=this,n=e.id,o=[];this.siteUrls[n]||(this.isLoading=!0,o.push(r["AjaxHelper"].fetch({module:"API",method:"SitesManager.getSiteUrlsFromId",idSite:n,filter_limit:"-1"}).then((function(e){t.siteUrls[n]=e||[]})))),this.siteExcludedQueryParams[n]||(this.isLoading=!0,o.push(r["AjaxHelper"].fetch({module:"API",method:"Overlay.getExcludedQueryParameters",idSite:n,filter_limit:"-1"}).then((function(e){t.siteExcludedQueryParams[n]=e||[]})))),Promise.all(o).then((function(){t.isLoading=!1,t.updateCurrentSiteInfo(),t.updateTrackingCode()}))},sendEmail:function(){var e=Object(r["translate"])("SitesManager_EmailInstructionsSubject");e=encodeURIComponent(e);var t=this.trackingCode;t=t.replace(/<[^>]+>/g,"");var n="".concat(Object(r["translate"])("SitesManager_JsTrackingTagHelp"),". ").concat(Object(r["translate"])("CoreAdminHome_JSTracking_CodeNoteBeforeClosingHeadEmail","'head"),"\n").concat(t);n=encodeURIComponent(n);var o="mailto:?subject=".concat(e,"&body=").concat(n);window.location.href=o},onCrossDomainToggle:function(){this.crossDomain&&(this.trackAllAliases=!0)},updateTrackingCode:function(){var e=this,t=this.site,n={piwikUrl:"".concat(ut).concat(gt),groupPageTitlesByDomain:this.groupByDomain?1:0,mergeSubdomains:this.trackAllSubdomains?1:0,mergeAliasUrls:this.trackAllAliases?1:0,visitorCustomVariables:this.trackCustomVars?st(this.customVars):0,customCampaignNameQueryParam:null,customCampaignKeywordParam:null,doNotTrack:this.doNotTrack?1:0,disableCookies:this.disableCookies?1:0,crossDomain:this.crossDomain?1:0,trackNoScript:this.trackNoScript?1:0,forceMatomoEndpoint:1};this.siteExcludedQueryParams[t.id]&&(n.excludedQueryParams=this.siteExcludedQueryParams[t.id]),this.useCustomCampaignParams&&(n.customCampaignNameQueryParam=this.customCampaignName,n.customCampaignKeywordParam=this.customCampaignKeyword),this.trackingCodeAbortController&&(this.trackingCodeAbortController.abort(),this.trackingCodeAbortController=null),this.trackingCodeAbortController=new AbortController,r["AjaxHelper"].post({module:"API",format:"json",method:"SitesManager.getJavascriptTag",idSite:t.id},n,{abortController:this.trackingCodeAbortController}).then((function(t){e.trackingCodeAbortController=null,e.trackingCode=t.value;var n=mt(e.$refs.trackingCode);n&&!e.isHighlighting&&(e.isHighlighting=!0,n.effect("highlight",{complete:function(){e.isHighlighting=!1}},1500))}))},updateCurrentSiteInfo:function(){this.hasManySiteUrls||(this.crossDomain=!1)},addCustomVar:function(){this.canAddMoreCustomVariables&&this.customVars.push({name:"",value:""}),this.canAddMoreCustomVariables=!!this.maxCustomVariables&&this.maxCustomVariables>this.customVars.length},onCustomVarNameKeydown:function(e,t){var n=this;setTimeout((function(){n.customVars[t].name=e.target.value,n.updateTrackingCode()}))},onCustomVarValueKeydown:function(e,t){var n=this;setTimeout((function(){n.customVars[t].value=e.target.value,n.updateTrackingCode()}))}},computed:{hasManySiteUrls:function(){var e=this.site;return this.siteUrls[e.id]&&this.siteUrls[e.id].length>1},currentSiteHost:function(){var e,t=null===(e=this.siteUrls[this.site.id])||void 0===e?void 0:e[0];return t?ct(t):""},currentSiteAlias:function(){var e,t="x.".concat(this.currentSiteHost),n=null===(e=this.siteUrls[this.site.id])||void 0===e?void 0:e[1];return n||t},currentSiteName:function(){return r["Matomo"].helper.htmlEntities(this.site.name)},jsTrackingIntro3a:function(){return Object(r["translate"])("CoreAdminHome_JSTrackingIntro3a",'<a href="https://matomo.org/integrate/" rel="noreferrer noopener" target="_blank">',"</a>")},jsTrackingIntro3b:function(){return Object(r["translate"])("CoreAdminHome_JSTrackingIntro3b")},jsTrackingIntro4a:function(){return Object(r["translate"])("CoreAdminHome_JSTrackingIntro4",'<a href="#image-tracking-link">',"</a>")},jsTrackingIntro5:function(){return Object(r["translate"])("CoreAdminHome_JSTrackingIntro5",'<a rel="noreferrer noopener" target="_blank" href="https://developer.matomo.org/guides/tracking-javascript-guide">',"</a>")},mergeSubdomainsDesc:function(){return Object(r["translate"])("CoreAdminHome_JSTracking_MergeSubdomainsDesc","x.".concat(this.currentSiteHost),"y.".concat(this.currentSiteHost))},learnMoreText:function(){var e="https://developer.matomo.org/guides/tracking-javascript-guide#measuring-domains-andor-sub-domains";return Object(r["translate"])("General_LearnMore",' (<a href="'.concat(e,'" rel="noreferrer noopener" target="_blank">'),"</a>)")},jsTrackCampaignParamsInlineHelp:function(){return Object(r["translate"])("CoreAdminHome_JSTracking_CustomCampaignQueryParamDesc",'<a href="https://matomo.org/faq/general/#faq_119" rel="noreferrer noopener" target="_blank">',"</a>")}}});pt.render=lt;var bt=pt,ht=(Object(r["createAngularJsAdapter"])({component:bt,scope:{defaultSite:{angularJsBind:"<"},maxCustomVariables:{angularJsBind:"<"},serverSideDoNotTrackEnabled:{angularJsBind:"<"}},directiveName:"matomoJsTrackingCodeGenerator"}),Object(i["createElementVNode"])("a",{name:"image-tracking-link"},null,-1)),vt={id:"image-tracking-code-options"},jt=["innerHTML"],ft=["innerHTML"],Ot={id:"image-tracking-goal-sub"},Ct={class:"row"},kt={class:"col s12 m6"},Vt={class:"col s12 m6"},St={id:"image-link-output-section"},Tt={id:"image-tracking-text"},Nt=["textContent"]; +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */function yt(e,t,n,o,a,r){var l=Object(i["resolveComponent"])("Field"),c=Object(i["resolveComponent"])("ContentBlock"),s=Object(i["resolveDirective"])("select-on-focus");return Object(i["openBlock"])(),Object(i["createBlock"])(c,{"content-title":e.translate("CoreAdminHome_ImageTracking"),anchor:"imageTracking"},{default:Object(i["withCtx"])((function(){return[ht,Object(i["createElementVNode"])("div",vt,[Object(i["createElementVNode"])("p",{innerHTML:e.imageTrackingIntro},null,8,jt),Object(i["createElementVNode"])("p",{innerHTML:e.imageTrackingIntro3},null,8,ft),Object(i["createVNode"])(l,{uicontrol:"site",name:"image-tracker-website",modelValue:e.site,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.site=t}),introduction:e.translate("General_Website")},null,8,["modelValue","introduction"]),Object(i["createVNode"])(l,{uicontrol:"text",name:"image-tracker-action-name","model-value":e.pageName,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.pageName=t,e.updateTrackingCode()}),disabled:e.isLoading,introduction:e.translate("General_Options"),title:e.translate("Actions_ColumnPageName")},null,8,["model-value","disabled","introduction","title"]),Object(i["createVNode"])(l,{uicontrol:"checkbox",name:"image-tracking-goal-check","model-value":e.trackGoal,"onUpdate:modelValue":t[2]||(t[2]=function(t){e.trackGoal=t,e.updateTrackingCode()}),disabled:e.isLoading,title:e.translate("CoreAdminHome_TrackAGoal")},null,8,["model-value","disabled","title"]),Object(i["withDirectives"])(Object(i["createElementVNode"])("div",Ot,[Object(i["createElementVNode"])("div",Ct,[Object(i["createElementVNode"])("div",kt,[Object(i["createVNode"])(l,{uicontrol:"select",name:"image-tracker-goal",options:e.siteGoals,disabled:e.isLoading,"model-value":e.trackIdGoal,"onUpdate:modelValue":t[3]||(t[3]=function(t){e.trackIdGoal=t,e.updateTrackingCode()})},null,8,["options","disabled","model-value"])]),Object(i["createElementVNode"])("div",Vt,[Object(i["createVNode"])(l,{uicontrol:"text",name:"image-revenue","model-value":e.revenue,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.revenue=t,e.updateTrackingCode()}),disabled:e.isLoading,"full-width":!0,title:"".concat(e.translate("CoreAdminHome_WithOptionalRevenue")," ").concat(e.currentSiteCurrency)},null,8,["model-value","disabled","title"])])])],512),[[i["vShow"],e.trackGoal]]),Object(i["createElementVNode"])("div",St,[Object(i["createElementVNode"])("h3",null,Object(i["toDisplayString"])(e.translate("CoreAdminHome_ImageTrackingLink")),1),Object(i["createElementVNode"])("div",Tt,[Object(i["withDirectives"])(Object(i["createElementVNode"])("pre",{textContent:Object(i["toDisplayString"])(e.trackingCode),ref:"trackingCode"},null,8,Nt),[[s,{}]])])])])]})),_:1},8,["content-title"])}function At(e,t){return Bt(e)||Ht(e,t)||Et(e,t)||wt()}function wt(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Et(e,t){if(e){if("string"===typeof e)return _t(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_t(e,t):void 0}}function _t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function Ht(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,a,r=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(o=n.next()).done);i=!0)if(r.push(o.value),t&&r.length===t)break}catch(c){l=!0,a=c}finally{try{i||null==n["return"]||n["return"]()}finally{if(l)throw a}}return r}}function Bt(e){if(Array.isArray(e))return e}var Lt=null,Ut=window,Dt=Ut.$,xt=window.location.host,It=window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/")),Pt=Object(i["defineComponent"])({props:{defaultSite:{type:Object,required:!0}},components:{ContentBlock:r["ContentBlock"],Field:y["Field"]},directives:{SelectOnFocus:r["SelectOnFocus"]},data:function(){return{isLoading:!1,site:this.defaultSite,pageName:"",trackGoal:!1,trackIdGoal:null,revenue:"",trackingCode:"",sites:{},goals:{},trackingCodeAbortController:null,isHighlighting:!1}},created:function(){this.updateTrackingCode=Object(r["debounce"])(this.updateTrackingCode),this.site&&this.site.id&&this.onSiteChanged(this.site)},watch:{site:function(e){this.onSiteChanged(e)}},methods:{onSiteChanged:function(e){var t,n,o,a=this;return this.trackIdGoal=null,Lt?t=Promise.resolve(Lt):(this.isLoading=!0,t=r["AjaxHelper"].fetch({method:"SitesManager.getCurrencySymbols",filter_limit:"-1"})),this.sites[e.id]?n=Promise.resolve(this.sites[e.id]):(this.isLoading=!0,n=r["AjaxHelper"].fetch({module:"API",method:"SitesManager.getSiteFromId",idSite:e.id})),this.goals[e.id]?o=Promise.resolve(this.goals[e.id]):(this.isLoading=!0,o=r["AjaxHelper"].fetch({module:"API",method:"Goals.getGoals",filter_limit:"-1",idSite:e.id})),Promise.all([t,n,o]).then((function(t){var n=At(t,3),o=n[0],r=n[1],i=n[2];a.isLoading=!1,Lt=o,a.sites[e.id]=r,a.goals[e.id]=i,a.updateTrackingCode()}))},updateTrackingCode:function(){var e=this,t={piwikUrl:"".concat(xt).concat(It),actionName:this.pageName,forceMatomoEndpoint:1};this.trackGoal&&this.trackIdGoal&&(t.idGoal=this.trackIdGoal,t.revenue=this.revenue),this.trackingCodeAbortController&&(this.trackingCodeAbortController.abort(),this.trackingCodeAbortController=null),this.trackingCodeAbortController=new AbortController,r["AjaxHelper"].post({module:"API",format:"json",method:"SitesManager.getImageTrackingCode",idSite:this.site.id},t,{abortController:this.trackingCodeAbortController}).then((function(t){e.trackingCodeAbortController=null,e.trackingCode=t.value;var n=Dt(e.$refs.trackingCode);n&&!e.isHighlighting&&(e.isHighlighting=!0,n.effect("highlight",{complete:function(){e.isHighlighting=!1}},1500))}))}},computed:{currentSiteCurrency:function(){return Lt?Lt[(this.sites[this.site.id].currency||"").toUpperCase()]:""},siteGoals:function(){var e=this.goals[this.site.id];return[{key:"",value:Object(r["translate"])("UserCountryMap_None")}].concat(Object.values(e||[]).map((function(e){return{key:"".concat(e.idgoal),value:e.name}})))},imageTrackingIntro:function(){var e=Object(r["translate"])("CoreAdminHome_ImageTrackingIntro1"),t=Object(r["translate"])("CoreAdminHome_ImageTrackingIntro2","<code><noscript></noscript></code>");return"".concat(e," ").concat(t)},imageTrackingIntro3:function(){var e="https://matomo.org/docs/tracking-api/reference/";return Object(r["translate"])("CoreAdminHome_ImageTrackingIntro3",'<a href="'.concat(e,'" rel="noreferrer noopener" target="_blank">'),"</a>")}}});Pt.render=yt;var Gt=Pt; +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */Object(r["createAngularJsAdapter"])({component:Gt,scope:{defaultSite:{angularJsBind:"<"}},directiveName:"matomoImageTrackingCodeGenerator"})}})})); //# sourceMappingURL=CoreAdminHome.umd.min.js.map
\ No newline at end of file diff --git a/plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.adapter.ts b/plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.adapter.ts new file mode 100644 index 0000000000..84e06eef09 --- /dev/null +++ b/plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.adapter.ts @@ -0,0 +1,19 @@ +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +import { createAngularJsAdapter } from 'CoreHome'; +import ImageTrackingCodeGenerator from './ImageTrackingCodeGenerator.vue'; + +export default createAngularJsAdapter({ + component: ImageTrackingCodeGenerator, + scope: { + defaultSite: { + angularJsBind: '<', + }, + }, + directiveName: 'matomoImageTrackingCodeGenerator', +}); diff --git a/plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.vue b/plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.vue new file mode 100644 index 0000000000..67b1d3d5e1 --- /dev/null +++ b/plugins/CoreAdminHome/vue/src/ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.vue @@ -0,0 +1,306 @@ +<!-- + Matomo - free/libre analytics platform + @link https://matomo.org + @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later +--> + +<template> + <ContentBlock + :content-title="translate('CoreAdminHome_ImageTracking')" + anchor="imageTracking" + > + <a name="image-tracking-link"></a> + + <div id="image-tracking-code-options"> + + <p v-html="imageTrackingIntro"></p> + <p v-html="imageTrackingIntro3"></p> + + <!-- website --> + <Field + uicontrol="site" + name="image-tracker-website" + v-model="site" + :introduction="translate('General_Website')" + /> + + <!-- action_name --> + <Field + uicontrol="text" + name="image-tracker-action-name" + :model-value="pageName" + @update:model-value="pageName = $event; updateTrackingCode()" + :disabled="isLoading" + :introduction="translate('General_Options')" + :title="translate('Actions_ColumnPageName')" + /> + + <!-- goal --> + <Field + uicontrol="checkbox" + name="image-tracking-goal-check" + :model-value="trackGoal" + @update:model-value="trackGoal = $event; updateTrackingCode()" + :disabled="isLoading" + :title="translate('CoreAdminHome_TrackAGoal')" + /> + + <div v-show="trackGoal" + id="image-tracking-goal-sub"> + <div class="row"> + <div class="col s12 m6"> + <Field + uicontrol="select" + name="image-tracker-goal" + :options="siteGoals" + :disabled="isLoading" + :model-value="trackIdGoal" + @update:model-value="trackIdGoal = $event; updateTrackingCode()" + /> + </div> + <div class="col s12 m6"> + <Field + uicontrol="text" + name="image-revenue" + :model-value="revenue" + @update:model-value="revenue = $event; updateTrackingCode()" + :disabled="isLoading" + :full-width="true" + :title="`${translate('CoreAdminHome_WithOptionalRevenue')} ${currentSiteCurrency}`" + /> + </div> + </div> + </div> + + <div id="image-link-output-section"> + <h3>{{ translate('CoreAdminHome_ImageTrackingLink') }}</h3> + + <div id="image-tracking-text"> + <pre v-select-on-focus="{}" v-text="trackingCode" ref="trackingCode"></pre> + </div> + </div> + </div> + </ContentBlock> +</template> + +<script lang="ts"> +import { defineComponent } from 'vue'; +import { + ContentBlock, + translate, + AjaxHelper, + SiteRef, + Site, + SelectOnFocus, + debounce, +} from 'CoreHome'; +import { Field } from 'CorePluginsAdmin'; + +interface Goal { + idgoal: string|number; + name: string; +} + +interface ImageTrackingCodeGeneratorState { + isLoading: boolean; + site: SiteRef; + pageName: string; + trackGoal: boolean; + trackIdGoal: string|null; + revenue: string; + trackingCode: string; + sites: Record<string, Site>; + goals: Record<string, Goal[]>; + trackingCodeAbortController: AbortController|null; + isHighlighting: boolean; +} + +interface GetImageTrackingResponse { + value: string; +} + +type CurrencyApiResponse = Record<string, string>; + +let currencySymbols: CurrencyApiResponse|null = null; + +const { $ } = window; + +const piwikHost = window.location.host; +const piwikPath = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')); + +export default defineComponent({ + props: { + defaultSite: { + type: Object, + required: true, + }, + }, + components: { + ContentBlock, + Field, + }, + directives: { + SelectOnFocus, + }, + data(): ImageTrackingCodeGeneratorState { + return { + isLoading: false, + site: this.defaultSite as SiteRef, + pageName: '', + trackGoal: false, + trackIdGoal: null, + revenue: '', + trackingCode: '', + sites: {}, + goals: {}, + trackingCodeAbortController: null, + isHighlighting: false, + }; + }, + created() { + this.updateTrackingCode = debounce(this.updateTrackingCode); + + if (this.site && this.site.id) { + this.onSiteChanged(this.site); + } + }, + watch: { + site(newValue: SiteRef) { + this.onSiteChanged(newValue); + }, + }, + methods: { + onSiteChanged(newValue: SiteRef) { + this.trackIdGoal = null; + + let currencyPromise: Promise<CurrencyApiResponse>; + if (currencySymbols) { + currencyPromise = Promise.resolve(currencySymbols!); + } else { + this.isLoading = true; + currencyPromise = AjaxHelper.fetch<CurrencyApiResponse>({ + method: 'SitesManager.getCurrencySymbols', + filter_limit: '-1', + }); + } + + let sitePromise: Promise<Site>; + if (this.sites[newValue.id]) { + sitePromise = Promise.resolve(this.sites[newValue.id]); + } else { + this.isLoading = true; + sitePromise = AjaxHelper.fetch<Site>({ + module: 'API', + method: 'SitesManager.getSiteFromId', + idSite: newValue.id, + }); + } + + let goalPromise: Promise<Goal[]>; + if (this.goals[newValue.id]) { + goalPromise = Promise.resolve(this.goals[newValue.id]); + } else { + this.isLoading = true; + goalPromise = AjaxHelper.fetch<Goal[]>({ + module: 'API', + method: 'Goals.getGoals', + filter_limit: '-1', + idSite: newValue.id, + }); + } + + return Promise.all([ + currencyPromise, + sitePromise, + goalPromise, + ]).then(([currencyResponse, site, goalsResponse]) => { + this.isLoading = false; + + currencySymbols = currencyResponse as CurrencyApiResponse; + this.sites[newValue.id] = site as Site; + this.goals[newValue.id] = goalsResponse as Goal[]; + + this.updateTrackingCode(); + }); + }, + updateTrackingCode() { + // get data used to generate the link + const postParams: Record<string, unknown> = { + piwikUrl: `${piwikHost}${piwikPath}`, + actionName: this.pageName, + forceMatomoEndpoint: 1, + }; + + if (this.trackGoal && this.trackIdGoal) { + postParams.idGoal = this.trackIdGoal; + postParams.revenue = this.revenue; + } + + if (this.trackingCodeAbortController) { + this.trackingCodeAbortController.abort(); + this.trackingCodeAbortController = null; + } + + this.trackingCodeAbortController = new AbortController(); + AjaxHelper.post<GetImageTrackingResponse>( + { + module: 'API', + format: 'json', + method: 'SitesManager.getImageTrackingCode', + idSite: this.site.id, + }, + postParams, + { abortController: this.trackingCodeAbortController }, + ).then((response) => { + this.trackingCodeAbortController = null; + + this.trackingCode = response.value; + + const imageCodeTextarea = $(this.$refs.trackingCode as HTMLElement); + if (imageCodeTextarea && !this.isHighlighting) { + this.isHighlighting = true; + imageCodeTextarea.effect('highlight', { + complete: () => { + this.isHighlighting = false; + }, + }, 1500); + } + }); + }, + }, + computed: { + currentSiteCurrency() { + if (!currencySymbols) { + return ''; + } + + return currencySymbols[(this.sites[this.site.id].currency || '').toUpperCase()]; + }, + siteGoals() { + const goalsResponse = this.goals[this.site.id]; + return [ + { key: '', value: translate('UserCountryMap_None') }, + ].concat( + Object.values(goalsResponse || []).map((g) => ({ key: `${g.idgoal}`, value: g.name })), + ); + }, + imageTrackingIntro() { + const first = translate('CoreAdminHome_ImageTrackingIntro1'); + const second = translate( + 'CoreAdminHome_ImageTrackingIntro2', + '<code><noscript></noscript></code>', + ); + return `${first} ${second}`; + }, + imageTrackingIntro3() { + const link = 'https://matomo.org/docs/tracking-api/reference/'; + return translate( + 'CoreAdminHome_ImageTrackingIntro3', + `<a href="${link}" rel="noreferrer noopener" target="_blank">`, + '</a>', + ); + }, + }, +}); + +</script> diff --git a/plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.adapter.ts b/plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.adapter.ts new file mode 100644 index 0000000000..daca15cb4b --- /dev/null +++ b/plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.adapter.ts @@ -0,0 +1,25 @@ +/*! + * Matomo - free/libre analytics platform + * + * @link https://matomo.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +import { createAngularJsAdapter } from 'CoreHome'; +import JsTrackingCodeGenerator from './JsTrackingCodeGenerator.vue'; + +export default createAngularJsAdapter({ + component: JsTrackingCodeGenerator, + scope: { + defaultSite: { + angularJsBind: '<', + }, + maxCustomVariables: { + angularJsBind: '<', + }, + serverSideDoNotTrackEnabled: { + angularJsBind: '<', + }, + }, + directiveName: 'matomoJsTrackingCodeGenerator', +}); diff --git a/plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.vue b/plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.vue new file mode 100644 index 0000000000..491a92a5d0 --- /dev/null +++ b/plugins/CoreAdminHome/vue/src/JsTrackingCodeGenerator/JsTrackingCodeGenerator.vue @@ -0,0 +1,622 @@ +<!-- + Matomo - free/libre analytics platform + @link https://matomo.org + @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later +--> + +<template> + <ContentBlock + anchor="javaScriptTracking" + :content-title="translate('CoreAdminHome_JavaScriptTracking')" + > + <div id="js-code-options"> + <p> + {{ translate('CoreAdminHome_JSTrackingIntro1') }} + <br/><br/> + {{ translate('CoreAdminHome_JSTrackingIntro2') }} + <span v-html="jsTrackingIntro3a"></span> + <span v-html="' ' + jsTrackingIntro3b"></span> + <br/><br/> + <span v-html="jsTrackingIntro4a"></span> + <br/><br/> + <span v-html="jsTrackingIntro5"></span> + <br><br/> + {{ translate('SitesManager_InstallationGuides') }} : + <a href="https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-wordpress/" + target="_blank" rel="noopener">WordPress</a> | + <a href="https://matomo.org/faq/new-to-piwik/how-do-i-integrate-matomo-with-squarespace-website/" + target="_blank" rel="noopener">Squarespace</a> | + <a href="https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-analytics-tracking-code-on-wix/" + target="_blank" rel="noopener">Wix</a> | + <a href="https://matomo.org/faq/how-to-install/faq_19424/" + target="_blank" rel="noopener">SharePoint</a> | + <a href="https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-analytics-tracking-code-on-joomla/" + target="_blank" rel="noopener">Joomla</a> | + <a href="https://matomo.org/faq/new-to-piwik/how-do-i-install-the-matomo-tracking-code-on-my-shopify-store/" + target="_blank" rel="noopener">Shopify</a> | + <a href="https://matomo.org/faq/new-to-piwik/how-do-i-use-matomo-analytics-within-gtm-google-tag-manager/" + target="_blank" rel="noopener">Google Tag Manager</a> + </p> + + <Field + uicontrol="site" + name="js-tracker-website" + class="jsTrackingCodeWebsite" + v-model="site" + :introduction="translate('General_Website')" + /> + + <div id="javascript-output-section"> + <div class="valign-wrapper trackingHelpHeader matchWidth"> + <div> + <h3>{{ translate('General_JsTrackingTag') }}</h3> + + <p> + {{ translate('CoreAdminHome_JSTracking_CodeNoteBeforeClosingHead', "</head>") }} + </p> + </div> + + <button class="btn" id="emailJsBtn" @click="sendEmail()"> + {{ translate('SitesManager_EmailInstructionsButton') }} + </button> + </div> + <div id="javascript-text"> + <pre v-select-on-focus="{}" class="codeblock" v-text="trackingCode" ref="trackingCode"/> + </div> + </div> + + <div id="optional-js-tracking-options"> + <!-- track across all subdomains --> + <div id="jsTrackAllSubdomainsInlineHelp" class="inline-help-node"> + <span v-html="mergeSubdomainsDesc"></span> + <span v-html="learnMoreText"></span> + </div> + + <Field + uicontrol="checkbox" + name="javascript-tracking-all-subdomains" + :model-value="trackAllSubdomains" + @update:model-value="trackAllSubdomains = $event; updateTrackingCode()" + :disabled="isLoading" + :introduction="translate('General_Options')" + :title="`${translate( + 'CoreAdminHome_JSTracking_MergeSubdomains', + )} ${currentSiteName}`" + inline-help="#jsTrackAllSubdomainsInlineHelp" + /> + </div> + + <!-- group page titles by site domain --> + <div id="jsTrackGroupByDomainInlineHelp" class="inline-help-node"> + {{ translate('CoreAdminHome_JSTracking_GroupPageTitlesByDomainDesc1', currentSiteHost) }} + </div> + + <Field + uicontrol="checkbox" + name="javascript-tracking-group-by-domain" + :model-value="groupByDomain" + @update:model-value="groupByDomain = $event; updateTrackingCode()" + :disabled="isLoading" + :title="translate('CoreAdminHome_JSTracking_GroupPageTitlesByDomain')" + inline-help="#jsTrackGroupByDomainInlineHelp" + /> + + <!-- track across all site aliases --> + <div id="jsTrackAllAliasesInlineHelp" class="inline-help-node"> + {{ translate('CoreAdminHome_JSTracking_MergeAliasesDesc', currentSiteAlias) }} + </div> + + <Field + uicontrol="checkbox" + name="javascript-tracking-all-aliases" + :model-value="trackAllAliases" + @update:model-value="trackAllAliases = $event; updateTrackingCode()" + :disabled="isLoading" + :title="`${translate('CoreAdminHome_JSTracking_MergeAliases')} ${currentSiteName}`" + inline-help="#jsTrackAllAliasesInlineHelp" + /> + </div> + + <Field + uicontrol="checkbox" + name="javascript-tracking-noscript" + :model-value="trackNoScript" + @update:model-value="trackNoScript = $event; updateTrackingCode()" + :disabled="isLoading" + :title="translate('CoreAdminHome_JSTracking_TrackNoScript')" + /> + + <h3>{{ translate('Mobile_Advanced') }}</h3> + + <p> + <a href="javascript:;" + v-show="!showAdvanced" + @click.prevent="showAdvanced = true">{{ translate('General_Show') }}</a> + <a href="javascript:;" + v-show="showAdvanced" + @click.prevent="showAdvanced = false">{{ translate('General_Hide') }}</a> + </p> + + <div id="javascript-advanced-options" v-show="showAdvanced"> + + <!-- visitor custom variable --> + <Field + uicontrol="checkbox" + name="javascript-tracking-visitor-cv-check" + :model-value="trackCustomVars" + @update:model-value="trackCustomVars = $event; updateTrackingCode()" + :disabled="isLoading" + :title="translate('CoreAdminHome_JSTracking_VisitorCustomVars')" + :inline-help="translate('CoreAdminHome_JSTracking_VisitorCustomVarsDesc')" + /> + + <div id="javascript-tracking-visitor-cv" v-show="trackCustomVars"> + <div class="row"> + <div class="col s12 m3"> + {{ translate('General_Name') }} + </div> + <div class="col s12 m3"> + {{ translate('General_Value') }} + </div> + </div> + <div class="row" v-for="(customVar, index) in customVars" :key="index"> + <div class="col s12 m6 l3"> + <input type="text" class="custom-variable-name" + @keydown="onCustomVarNameKeydown($event, index)" + placeholder="e.g. Type"/> + </div> + <div class="col s12 m6 l3"> + <input type="text" class="custom-variable-value" + @keydown="onCustomVarValueKeydown($event, index)" + placeholder="e.g. Customer"/> + </div> + </div> + <div class="row" v-show="canAddMoreCustomVariables"> + <div class="col s12"> + <a href="javascript:;" + @click="addCustomVar()" + class="add-custom-variable" + > + <span class="icon-add"></span> {{ translate('General_Add') }} + </a> + </div> + </div> + </div> + + <!-- cross domain support --> + <div id="jsCrossDomain" class="inline-help-node"> + {{ translate('CoreAdminHome_JSTracking_CrossDomain') }} + <br/> + {{ translate('CoreAdminHome_JSTracking_CrossDomain_NeedsMultipleDomains') }} + </div> + + <Field + uicontrol="checkbox" + name="javascript-tracking-cross-domain" + :model-value="crossDomain" + @update:model-value="crossDomain = $event; updateTrackingCode(); onCrossDomainToggle();" + :disabled="isLoading || !hasManySiteUrls" + :title="translate('CoreAdminHome_JSTracking_EnableCrossDomainLinking')" + inline-help="#jsCrossDomain" + /> + + <!-- do not track support --> + <div id="jsDoNotTrackInlineHelp" class="inline-help-node"> + {{ translate('CoreAdminHome_JSTracking_EnableDoNotTrackDesc') }} + <span v-if="serverSideDoNotTrackEnabled"> + <br/> + {{ translate('CoreAdminHome_JSTracking_EnableDoNotTrack_AlreadyEnabled') }} + </span> + </div> + + <Field + uicontrol="checkbox" + name="javascript-tracking-do-not-track" + :model-value="doNotTrack" + @update:model-value="doNotTrack = $event; updateTrackingCode()" + :disabled="isLoading" + :title="translate('CoreAdminHome_JSTracking_EnableDoNotTrack')" + inline-help="#jsDoNotTrackInlineHelp" + /> + + <!-- disable all cookies options --> + <Field + uicontrol="checkbox" + name="javascript-tracking-disable-cookies" + :model-value="disableCookies" + @update:model-value="disableCookies = $event; updateTrackingCode()" + :disabled="isLoading" + :title="translate('CoreAdminHome_JSTracking_DisableCookies')" + :inline-help="translate('CoreAdminHome_JSTracking_DisableCookiesDesc')" + /> + + <!-- custom campaign name/keyword query params --> + <div id="jsTrackCampaignParamsInlineHelp" + class="inline-help-node" + v-html="jsTrackCampaignParamsInlineHelp"> + </div> + + <Field + uicontrol="checkbox" + name="custom-campaign-query-params-check" + :model-value="useCustomCampaignParams" + @update:model-value="useCustomCampaignParams = $event; updateTrackingCode()" + :disabled="isLoading" + :title="translate('CoreAdminHome_JSTracking_CustomCampaignQueryParam')" + inline-help="#jsTrackCampaignParamsInlineHelp" + /> + + <div v-show="useCustomCampaignParams" id="js-campaign-query-param-extra"> + <div class="row"> + <div class="col s12"> + <Field + uicontrol="text" + name="custom-campaign-name-query-param" + :model-value="customCampaignName" + @update:model-value="customCampaignName = $event; updateTrackingCode()" + :disabled="isLoading" + :title="translate('CoreAdminHome_JSTracking_CampaignNameParam')" + /> + </div> + </div> + <div class="row"> + <div class="col s12"> + <Field + uicontrol="text" + name="custom-campaign-keyword-query-param" + :model-value="customCampaignKeyword" + @update:model-value="customCampaignKeyword = $event; updateTrackingCode()" + :disabled="isLoading" + :title="translate('CoreAdminHome_JSTracking_CampaignKwdParam')" + /> + </div> + </div> + </div> + + </div> + + </ContentBlock> +</template> + +<script lang="ts"> +import { defineComponent } from 'vue'; +import { + ContentBlock, + translate, + AjaxHelper, + SiteRef, + SelectOnFocus, + debounce, + Matomo, +} from 'CoreHome'; +import { Field } from 'CorePluginsAdmin'; + +interface CustomVar { + name: string; + value: string; +} + +interface JsTrackingCodeGeneratorState { + showAdvanced: boolean; + site: SiteRef; + trackingCode: string; + trackAllSubdomains: boolean; + isLoading: boolean; + siteUrls: Record<string, string[]>; + siteExcludedQueryParams: Record<string, string[]>, + crossDomain: boolean; + groupByDomain: boolean; + trackAllAliases: boolean; + trackNoScript: boolean; + trackCustomVars: boolean; + customVars: CustomVar[]; + canAddMoreCustomVariables: boolean; + doNotTrack: boolean; + disableCookies: boolean; + useCustomCampaignParams: boolean; + customCampaignName: string; + customCampaignKeyword: string; + trackingCodeAbortController: AbortController|null; + isHighlighting: boolean; +} + +interface GetJavascriptTagResponse { + value: string; +} + +function getHostNameFromUrl(url: string) { + const urlObj = new URL(url); + return urlObj.hostname; +} + +function getCustomVarArray(cvars: CustomVar[]) { + return cvars.map((cv) => [cv.name, cv.value]); +} + +const { $ } = window; + +const piwikHost = window.location.host; +const piwikPath = window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')); + +export default defineComponent({ + props: { + defaultSite: { + type: Object, + required: true, + }, + maxCustomVariables: Number, + serverSideDoNotTrackEnabled: Boolean, + }, + data(): JsTrackingCodeGeneratorState { + return { + showAdvanced: false, + site: this.defaultSite as SiteRef, + trackingCode: '', + trackAllSubdomains: false, + isLoading: false, + siteUrls: {}, + siteExcludedQueryParams: {}, + crossDomain: false, + groupByDomain: false, + trackAllAliases: false, + trackNoScript: false, + trackCustomVars: false, + customVars: [], + canAddMoreCustomVariables: !!this.maxCustomVariables && this.maxCustomVariables > 0, + doNotTrack: false, + disableCookies: false, + useCustomCampaignParams: false, + customCampaignName: '', + customCampaignKeyword: '', + trackingCodeAbortController: null, + isHighlighting: false, + }; + }, + components: { + ContentBlock, + Field, + }, + directives: { + SelectOnFocus, + }, + created() { + this.onCustomVarNameKeydown = debounce(this.onCustomVarNameKeydown, 100); + this.onCustomVarValueKeydown = debounce(this.onCustomVarValueKeydown, 100); + + this.addCustomVar(); + + if (this.site && this.site.id) { + this.onSiteChanged(this.site); + } + }, + watch: { + site(newValue: SiteRef) { + this.onSiteChanged(newValue); + }, + }, + methods: { + onSiteChanged(newValue: SiteRef) { + const idSite = newValue.id; + + // if data is already loaded, don't do an AJAX request + + const promises: Promise<unknown>[] = []; + if (!this.siteUrls[idSite]) { + this.isLoading = true; + + promises.push( + AjaxHelper.fetch({ + module: 'API', + method: 'SitesManager.getSiteUrlsFromId', + idSite, + filter_limit: '-1', + }).then((data) => { + this.siteUrls[idSite] = data || []; + }), + ); + } + + if (!this.siteExcludedQueryParams[idSite]) { + this.isLoading = true; + + promises.push( + AjaxHelper.fetch({ + module: 'API', + method: 'Overlay.getExcludedQueryParameters', + idSite, + filter_limit: '-1', + }).then((data) => { + this.siteExcludedQueryParams[idSite] = data || []; + }), + ); + } + + Promise.all(promises).then(() => { + this.isLoading = false; + this.updateCurrentSiteInfo(); + this.updateTrackingCode(); + }); + }, + sendEmail() { + let subjectLine = translate('SitesManager_EmailInstructionsSubject'); + subjectLine = encodeURIComponent(subjectLine); + + let { trackingCode } = this; + trackingCode = trackingCode.replace(/<[^>]+>/g, ''); + + let bodyText = `${translate('SitesManager_JsTrackingTagHelp')}. ${translate( + 'CoreAdminHome_JSTracking_CodeNoteBeforeClosingHeadEmail', + '\'head', + )}\n${trackingCode}`; + bodyText = encodeURIComponent(bodyText); + + const linkText = `mailto:?subject=${subjectLine}&body=${bodyText}`; + window.location.href = linkText; + }, + onCrossDomainToggle() { + if (this.crossDomain) { + this.trackAllAliases = true; + } + }, + updateTrackingCode() { + const { site } = this; + + // get params used to generate JS code + const params: Record<string, unknown> = { + piwikUrl: `${piwikHost}${piwikPath}`, + groupPageTitlesByDomain: this.groupByDomain ? 1 : 0, + mergeSubdomains: this.trackAllSubdomains ? 1 : 0, + mergeAliasUrls: this.trackAllAliases ? 1 : 0, + visitorCustomVariables: this.trackCustomVars ? getCustomVarArray(this.customVars) : 0, + customCampaignNameQueryParam: null, + customCampaignKeywordParam: null, + doNotTrack: this.doNotTrack ? 1 : 0, + disableCookies: this.disableCookies ? 1 : 0, + crossDomain: this.crossDomain ? 1 : 0, + trackNoScript: this.trackNoScript ? 1 : 0, + forceMatomoEndpoint: 1, + }; + + if (this.siteExcludedQueryParams[site.id]) { + params.excludedQueryParams = this.siteExcludedQueryParams[site.id]; + } + + if (this.useCustomCampaignParams) { + params.customCampaignNameQueryParam = this.customCampaignName; + params.customCampaignKeywordParam = this.customCampaignKeyword; + } + + if (this.trackingCodeAbortController) { + this.trackingCodeAbortController.abort(); + this.trackingCodeAbortController = null; + } + + this.trackingCodeAbortController = new AbortController(); + + AjaxHelper.post<GetJavascriptTagResponse>( + { + module: 'API', + format: 'json', + method: 'SitesManager.getJavascriptTag', + idSite: site.id, + }, + params, + { + abortController: this.trackingCodeAbortController, + }, + ).then((response) => { + this.trackingCodeAbortController = null; + + this.trackingCode = response.value; + + const jsCodeTextarea = $(this.$refs.trackingCode as HTMLElement); + if (jsCodeTextarea && !this.isHighlighting) { + this.isHighlighting = true; + jsCodeTextarea.effect('highlight', { + complete: () => { + this.isHighlighting = false; + }, + }, 1500); + } + }); + }, + updateCurrentSiteInfo() { + if (!this.hasManySiteUrls) { + // we make sure to disable cross domain if it has only one url or less + this.crossDomain = false; + } + }, + addCustomVar() { + if (this.canAddMoreCustomVariables) { + this.customVars.push({ name: '', value: '' }); + } + + this.canAddMoreCustomVariables = !!this.maxCustomVariables + && this.maxCustomVariables > this.customVars.length; + }, + onCustomVarNameKeydown(event: KeyboardEvent, index: number) { + setTimeout(() => { + this.customVars[index].name = (event.target as HTMLInputElement).value; + this.updateTrackingCode(); + }); + }, + onCustomVarValueKeydown(event: KeyboardEvent, index: number) { + setTimeout(() => { + this.customVars[index].value = (event.target as HTMLInputElement).value; + this.updateTrackingCode(); + }); + }, + }, + computed: { + hasManySiteUrls() { + const { site } = this; + return this.siteUrls[site.id] && this.siteUrls[site.id].length > 1; + }, + currentSiteHost() { + const siteUrl = this.siteUrls[this.site.id]?.[0]; + if (!siteUrl) { + return ''; + } + + return getHostNameFromUrl(siteUrl); + }, + currentSiteAlias() { + const defaultAliasUrl = `x.${this.currentSiteHost}`; + const alias = this.siteUrls[this.site.id]?.[1]; + return alias || defaultAliasUrl; + }, + currentSiteName() { + return Matomo.helper.htmlEntities(this.site.name); + }, + jsTrackingIntro3a() { + return translate( + 'CoreAdminHome_JSTrackingIntro3a', + '<a href="https://matomo.org/integrate/" rel="noreferrer noopener" target="_blank">', + '</a>', + ); + }, + jsTrackingIntro3b() { + return translate('CoreAdminHome_JSTrackingIntro3b'); + }, + jsTrackingIntro4a() { + return translate( + 'CoreAdminHome_JSTrackingIntro4', + '<a href="#image-tracking-link">', + '</a>', + ); + }, + jsTrackingIntro5() { + return translate( + 'CoreAdminHome_JSTrackingIntro5', + '<a rel="noreferrer noopener" target="_blank" ' + + 'href="https://developer.matomo.org/guides/tracking-javascript-guide">', + '</a>', + ); + }, + mergeSubdomainsDesc() { + return translate( + 'CoreAdminHome_JSTracking_MergeSubdomainsDesc', + `x.${this.currentSiteHost}`, + `y.${this.currentSiteHost}`, + ); + }, + learnMoreText() { + const subdomainsLink = 'https://developer.matomo.org/guides/tracking-javascript-guide' + + '#measuring-domains-andor-sub-domains'; + return translate( + 'General_LearnMore', + ` (<a href="${subdomainsLink}" rel="noreferrer noopener" target="_blank">`, + '</a>)', + ); + }, + jsTrackCampaignParamsInlineHelp() { + return translate( + 'CoreAdminHome_JSTracking_CustomCampaignQueryParamDesc', + '<a href="https://matomo.org/faq/general/#faq_119" rel="noreferrer noopener" target="_blank">', + '</a>', + ); + }, + }, +}); + +</script> diff --git a/plugins/CoreAdminHome/vue/src/index.ts b/plugins/CoreAdminHome/vue/src/index.ts index 96847a6c02..b0597ead4b 100644 --- a/plugins/CoreAdminHome/vue/src/index.ts +++ b/plugins/CoreAdminHome/vue/src/index.ts @@ -8,7 +8,15 @@ import './ArchivingSettings/ArchivingSettings.adapter'; import './BrandingSettings/BrandingSettings.adapter'; import './SmtpSettings/SmtpSettings.adapter'; +import './JsTrackingCodeGenerator/JsTrackingCodeGenerator.adapter'; +import './ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.adapter'; export { default as ArchivingSettings } from './ArchivingSettings/ArchivingSettings.vue'; export { default as BrandingSettings } from './BrandingSettings/BrandingSettings.vue'; export { default as SmtpSettings } from './SmtpSettings/SmtpSettings.vue'; +export { + default as JsTrackingCodeGenerator, +} from './JsTrackingCodeGenerator/JsTrackingCodeGenerator.vue'; +export { + default as ImageTrackingCodeGenerator, +} from './ImageTrackingCodeGenerator/ImageTrackingCodeGenerator.vue'; |