Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Matomo Analytics Support #112

Merged
merged 3 commits into from
Mar 19, 2022
Merged

Conversation

kenjibailly
Copy link
Contributor

@kenjibailly kenjibailly commented Mar 16, 2022

Proposed Changes

In addition to Matomo Support #111 to track browsers with javascript disabled

  • Image tracking tag in body

Checklist

  • Tested locally
  • Ran yarn ci to test my code
  • Did not add any unnecessary changes
  • All my changes appear after other changes in each file
  • Included a screenshot (if adding a new button)
  • 馃殌

Copy link
Contributor

@timothystewart6 timothystewart6 left a comment

Choose a reason for hiding this comment

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

I think we're missing some additional config for ENV variables that you had in your last PR? We need to always configure the RAZZLE_ ones too! See UMAMI_WEBSITE_ID or GA_TRACKING_ID in server.js

@kenjibailly
Copy link
Contributor Author

These env's are the same as for the other script, so these have already been initialized. Or am I not getting something here? I don't understand

@timothystewart6
Copy link
Contributor

If they are not configured there we might not have access to them while debugging locally, although this is really only needed server side it's still nice to be consistent.

@kenjibailly
Copy link
Contributor Author

Isn't what this is for?
Copied this from #111

        MATOMO_URL: nodeIsProduction
          ? process.env.MATOMO_URL
          : process.env.RAZZLE_MATOMO_URL,
        MATOMO_SITE_ID: nodeIsProduction
          ? process.env.MATOMO_SITE_ID
          : process.env.RAZZLE_MATOMO_SITE_ID,

Also, I saw the commit had been applied from #111 yet I cannot see the changes in the files.
It's my second time contributing to a project, real github contribution noob here. Sorry

@timothystewart6
Copy link
Contributor

No problem! Yes, that's the change but it's in a PR that you closed. I don't see those changes in this PR listed here https://github.com/techno-tim/littlelink-server/pull/112/files

You are so close, just open up your current PR and add those changes and push it up!

@kenjibailly
Copy link
Contributor Author

No problem! Yes, that's the change but it's in a PR that you closed. I don't see those changes in this PR listed here https://github.com/techno-tim/littlelink-server/pull/112/files

You are so close, just open up your current PR and add those changes and push it up!

I didn't mean to do that! I had a problem where my first repository committed every file under my comment "matomo support" and therefore I deleted it and created a new one. Didn't know that would close #111 since I thought that was already pushed.

I think I have now added it again, do we have everything now? :)

@timothystewart6
Copy link
Contributor

this closes #41

@timothystewart6
Copy link
Contributor

Thank you! Will review in the morning!

@kenjibailly
Copy link
Contributor Author

Thank you for bearing with me :)

src/server.js Outdated
runtimeConfig.MATOMO_URL && runtimeConfig.MATOMO_SITE_ID
? `
<!-- Matomo Image Tracker-->
<img referrerpolicy="no-referrer-when-downgrade" src="${runtimeConfig.MATOMO_URL}matomo.php?idsite=${runtimeConfig.MATOMO_SITE_ID}&amp;rec=1" style="border:0" alt="" />
Copy link
Contributor

Choose a reason for hiding this comment

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

one small thing here! I think this would be

<img referrerpolicy="no-referrer-when-downgrade" src="${runtimeConfig.MATOMO_URL}/matomo.php?idsite=${runtimeConfig.MATOMO_SITE_ID}&amp;rec=1" style="border:0" alt="" />

(missing / between the site and matomo.php? ) Otherwise your url would have to end in a trailing slash, which might be fine but also odd that you would have to know to end your site in a slash. What do you think?

after this, looks good!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason I did this is because the slash is there as well in the other part of the config where it just asks for the url. I didn't test if the slash was necessary there. Second thing I was thinking is that they will probably check out their config with this same code cause don't know how else you can get the site ID. I was thinking if they copied the URL from there (which has trailing slash) it would then create errors.

I also thought the same like you that it's pretty confusing. I guess it's confusing depending from which point you view it and could be either way confusing.

I'll add another commit to what you said. Maybe my logic is too far fetched.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see what you mean but I think this is cleaner for the person using the URL as a variable, keep the ugly stuff in code ;) Thank you!

@timothystewart6
Copy link
Contributor

You're doing fine! One small question / possible fix, after that looks good!

No trailing slash needed in the variable "MATOMO_URL"
@kenjibailly
Copy link
Contributor Author

Fix has been committed :D

@kenjibailly kenjibailly changed the title Matomo Image Tracking Support Matomo Analytics Support Mar 19, 2022
@timothystewart6
Copy link
Contributor

Thank you for you contribution!

@timothystewart6 timothystewart6 merged commit b2e3dce into techno-tim:master Mar 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants