Skip to content

Added GTM installation guide in no-data and tracking code pages #20577

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 19, 2023

Conversation

AltamashShaikh
Copy link
Contributor

Description:

Added GTM installation guide in no-data and tracking code pages.
Fixes: #PG-2730

Review

@AltamashShaikh AltamashShaikh added the Needs Review PRs that need a code review label Apr 13, 2023
@AltamashShaikh AltamashShaikh requested a review from bx80 April 13, 2023 03:57
@AltamashShaikh AltamashShaikh assigned sgiehl and snake14 and unassigned sgiehl and snake14 Apr 13, 2023
@@ -229,6 +229,7 @@ public function siteWithoutDataTabs()
'tagManagerActive' => $tagManagerActive,
'consentManagerName' => false,
'cloudflare' => $this->siteContentDetector->cloudflare,
'isCloud' => Manager::getInstance()->isPluginActivated('Cloud')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tsteur This check should be fine to proceed ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think we should try to avoid any code in core that is cloud only. If we need to replace some parts on cloud we can use e.g. events that allow a plugin to overwrite / replace certain parts. That way we can then replace e.g. the GTM intro within the cloud plugin.

And I guess at some point I would also start to refactor all that code again as having one big template that handles everything is a bit messy. Having e.g. separate classes for each type of detection might be smarter, easier to understand and better testable. Those classes could then have e.g. a method renderTab that allows providing additional tabs for the page (where needed) or a method to add sections to the other ways tab or similar. These methods could then have an event that allows to change/replace the content the method returns to make it adjustable on cloud.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sgiehl Removed isCloud and started using postEvent to override in other plugins

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sgiehl Does this approach sounds good to you ?
Similarly can split it for Cloudflare and others in future

Copy link
Contributor

@snake14 snake14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright to me. I could see the new GTM sections in the tracking code and no data views.

I did notice that the MTM tab of the no data view is in a content block like it was in 4.x-dev. I don't know if you want to address that as part of this PR.

Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in #20577 (comment) I guess I would have solved that a different way. The implementation of the no data screen in general is currently already a bit messy and we are only adding more and more messy code to it. I would have directly refactored that all so it's more flexible and would make it easier for plugins to hook into in order to add new tabs or change the content of certain tabs.
This implementation will now only allow to replace the content of GTM tab, but that might be enough for now. We nevertheless should consider refactoring all that stuff again.

@Stan-vw @mattab One general thing that came to my mind when viewing the no data screen, which is unrelated to this PR:
The Email these instructions button is currently always visible when switching through the tabs. But the instructions that would be send are actually always the same and a mixture of the contents of all tabs (except GTM and Cloudflare). I would have actually expected that when clicking the button while being on the GTM tab, that the instructions for GTM would be included and not the general instructions.

@@ -12,6 +12,9 @@
<li class="tab col {{ columnClass }}"><a {% if siteType != constant('Piwik\\Plugins\\SitesManager\\SitesManager::SITE_TYPE_UNKNOWN') and (consentManagerName == false) and (activeTab == '') %} class="active" {% endif %} href="#integrations">{{ 'SitesManager_Integrations'|translate }}</a></li>
<li class="tab col {{ columnClass }}"><a {% if (siteType == constant('Piwik\\Plugins\\SitesManager\\SitesManager::SITE_TYPE_UNKNOWN') and (activeTab == '')) or consentManagerName %} class="active" {% endif %} href="#tracking-code">{{ 'CoreAdminHome_TrackingCode'|translate }}</a></li>
<li class="tab col {{ columnClass }}"><a href="#mtm">{{ 'SitesManager_SiteWithoutDataMatomoTagManager'|translate }}</a></li>
{% if gtmUsed %}
<li class="tab col s2"><a {% if activeTab == 'gtm' %} class="active" {% endif %} href="#google-tag-manager">{{ 'SitesManager_SiteWithoutDataGoogleTagManager'|translate }}</a></li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The s2 class is actually for having 6 columns. So if only GTM or Cloudflare tabs are displayed, there is actually one space free. But as there is no class in materializecss to have 5 columns, we can maybe leave it as is for now...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes there is nothing which which is available

Copy link
Contributor

@Stan-vw Stan-vw Apr 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for highlighting this @sgiehl. I'm sure we're all in favour of refactoring as we go. I'm not sure if this work was pushed through in too much of a hurry to include it, whether we could've approached it better, etc. We can discuss it in an upcoming retro if desired.
Also agreed on the idea that the email should include at least info regarding the tab that the user is looking at. Let's create a ticket to look at the email holistically, validate what users want/need and improve it accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI for e-mail we have #DEV-16664 created internally

@michalkleiner
Copy link
Contributor

A few minor non-functional notes from me, can't speak too much towards the functional change yet.
Otherwise I'd agree with Stefan's sentiment on the markup being a bit untidy, carrying over or even increasing technical debt. We may need to revisit this at a later date.

@AltamashShaikh
Copy link
Contributor Author

@sgiehl I have pinged you on Slack for ideas on refactor and included suggestion by @michalkleiner
Can we merge this PR ?

@sgiehl sgiehl added this to the 5.0.0 milestone Apr 19, 2023
@sgiehl sgiehl added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Apr 19, 2023
@sgiehl sgiehl merged commit 2dc4361 into 5.x-dev Apr 19, 2023
@sgiehl sgiehl deleted the PG-2730-gtm-tab branch April 19, 2023 13:02
AltamashShaikh added a commit that referenced this pull request Apr 20, 2023
* Added GTM installation guide in no-data and tracking code pages, #PG-2730

* Updated UI test

* Started mentioning the tracking code below step4 for onpremise

* UI screenshot updated

* Textual change

* Screenshot updated

* Changes to support steps override GTM steps by other plugins

* Updated unwanted line

* Updated UI screenshot

* UI screenshot updated

* Formatting changes
sgiehl pushed a commit that referenced this pull request Apr 20, 2023
* Added GTM installation guide in no-data and tracking code pages, #PG-2730

* Updated UI test

* Started mentioning the tracking code below step4 for onpremise

* UI screenshot updated

* Textual change

* Screenshot updated

* Changes to support steps override GTM steps by other plugins

* Updated unwanted line

* Updated UI screenshot

* UI screenshot updated

* Formatting changes
sgiehl pushed a commit that referenced this pull request Apr 20, 2023
…) (#20606)

* Added GTM installation guide in no-data and tracking code pages, #PG-2730

* Updated UI test

* Started mentioning the tracking code below step4 for onpremise

* UI screenshot updated

* Textual change

* Screenshot updated

* Changes to support steps override GTM steps by other plugins

* Updated unwanted line

* Updated UI screenshot

* UI screenshot updated

* Formatting changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Development

Successfully merging this pull request may close these issues.

5 participants