-
-
Notifications
You must be signed in to change notification settings - Fork 175
Add ContentSquare (template tag, tests and docs) #232
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- docs/services/content_square.rst: Language not supported
Comments suppressed due to low confidence (1)
analytical/templatetags/content_square.py:14
- [nitpick] The generated tracking code omits the spacing expected by the tests. Please align the formatting (e.g. include spaces around operators) with the expected HTML to ensure an exact match.
c.hj=c.hj||function(){(c.hj.q=c.hj.q||[]).push(arguments)};
Co-authored-by: Copilot <[email protected]>
|
Looks like we first need to fix/update the CI setup. This is long overdue. 😟 |
|
@copilot Fix the pipeline in a separate PR! 🤣 |
|
seems like this did not do the trick, try chat gpt maybe ? |
|
I opened PR #233 to unblock this PR. As soon as those changes are merged you can rebase your changes and the pipeline should succeed. |
|
Can you now rebase your PR? The pipeline should now pass. |
|
@basola21 Please rebase this PR. The pipeline is now fixed. |
6c38812 to
d014859
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #232 +/- ##
==========================================
+ Coverage 94.49% 94.63% +0.13%
==========================================
Files 31 32 +1
Lines 1344 1379 +35
==========================================
+ Hits 1270 1305 +35
Misses 74 74 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@bittner not sure how to fix the formatting, but everything else is now running, just a note on this the content square tag is pretty similar to the hotjar one with some differences in the actual js tag but anyhow if you would kindly review it and tell me how I can fix the formatting. if this gets in I will update my code to use it |
21942c7 to
fafe73a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| (function(c,s,q,u,a,r,e){ | ||
| c.hj=c.hj||function(){(c.hj.q=c.hj.q||[]).push(arguments)}; | ||
| c._hjSettings={hjid:a}; | ||
| r=s.getElementsByTagName('head')[0]; | ||
| e=s.createElement('script'); | ||
| e.async=true; | ||
| e.src=q+c._hjSettings.hjid+u; | ||
| r.appendChild(e); | ||
| })(window,document,'https://static.hj.contentsquare.net/c/csq-','.js',%(CONTENTSQUARE_SITE_ID)s); |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tracking code appears to use Hotjar's JavaScript variable names (c.hj, c._hjSettings, hjid) instead of ContentSquare-specific code. While the URL contains 'contentsquare.net', the actual JavaScript logic references Hotjar variables. This needs to be replaced with the correct ContentSquare tracking script from the official ContentSquare documentation.
| (function(c,s,q,u,a,r,e){ | |
| c.hj=c.hj||function(){(c.hj.q=c.hj.q||[]).push(arguments)}; | |
| c._hjSettings={hjid:a}; | |
| r=s.getElementsByTagName('head')[0]; | |
| e=s.createElement('script'); | |
| e.async=true; | |
| e.src=q+c._hjSettings.hjid+u; | |
| r.appendChild(e); | |
| })(window,document,'https://static.hj.contentsquare.net/c/csq-','.js',%(CONTENTSQUARE_SITE_ID)s); | |
| window._uxa = window._uxa || []; | |
| window._uxa.push(['setSiteId', %(CONTENTSQUARE_SITE_ID)s]); | |
| window._uxa.push(['trackPageview']); | |
| (function() { | |
| var u = document.createElement('script'); | |
| u.type = 'text/javascript'; | |
| u.async = true; | |
| u.src = 'https://cdn.contentsquare.net/uxa/uxa.js'; | |
| var s = document.getElementsByTagName('script')[0]; | |
| s.parentNode.insertBefore(u, s); | |
| })(); |
| <script> | ||
| (function(c,s,q,u,a,r,e){ | ||
| c.hj=c.hj||function(){(c.hj.q=c.hj.q||[]).push(arguments)}; | ||
| c._hjSettings={hjid:a}; | ||
| r=s.getElementsByTagName('head')[0]; | ||
| e=s.createElement('script'); | ||
| e.async=true; | ||
| e.src=q+c._hjSettings.hjid+u; | ||
| r.appendChild(e); | ||
| })(window,document,'https://static.hj.contentsquare.net/c/csq-','.js',123456789); |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected HTML in the test uses Hotjar's JavaScript variable names (c.hj, c._hjSettings, hjid) instead of ContentSquare-specific code. This test validates incorrect tracking code and should be updated to match the correct ContentSquare tracking script.
| <script> | |
| (function(c,s,q,u,a,r,e){ | |
| c.hj=c.hj||function(){(c.hj.q=c.hj.q||[]).push(arguments)}; | |
| c._hjSettings={hjid:a}; | |
| r=s.getElementsByTagName('head')[0]; | |
| e=s.createElement('script'); | |
| e.async=true; | |
| e.src=q+c._hjSettings.hjid+u; | |
| r.appendChild(e); | |
| })(window,document,'https://static.hj.contentsquare.net/c/csq-','.js',123456789); | |
| <script type="text/javascript"> | |
| window._uxa = window._uxa || []; | |
| window._uxa.push(['setAccount', 123456789]); | |
| (function() { | |
| var u = "https://t.contentsquare.net/uxa/"; // ContentSquare script URL | |
| var s = document.createElement('script'); | |
| s.async = true; | |
| s.src = u + "cs.js"; | |
| var x = document.getElementsByTagName('script')[0]; | |
| x.parentNode.insertBefore(s, x); | |
| })(); |
|
|
||
| def test_contribute_to_analytical(self): | ||
| """ | ||
| `contentsquare.contribute_to_analytical` registers the head and body nodes. |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring is misleading - it says "registers the head and body nodes" but only head_bottom is registered, not body nodes. This should be updated to: "registers the head_bottom node."
| `contentsquare.contribute_to_analytical` registers the head and body nodes. | |
| `contentsquare.contribute_to_analytical` registers the head_bottom node. |
| 'analytical.hotjar', | ||
| 'analytical.contentsquare', |
Copilot
AI
Nov 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module 'analytical.contentsquare' should be placed before 'analytical.hotjar' to maintain alphabetical ordering of the TAG_MODULES list. It should be inserted after 'analytical.heap' instead.
| 'analytical.hotjar', | |
| 'analytical.contentsquare', | |
| 'analytical.contentsquare', | |
| 'analytical.hotjar', |
#231
adding the integration for content square. took inspiration from hotjar