Skip to content

Conversation

@basola21
Copy link

@basola21 basola21 commented Apr 4, 2025

#231

adding the integration for content square. took inspiration from hotjar

@basola21 basola21 requested a review from Copilot April 4, 2025 06:05
Copy link

Copilot AI left a 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)};

@bittner
Copy link
Member

bittner commented Apr 4, 2025

Looks like we first need to fix/update the CI setup. This is long overdue. 😟

@bittner
Copy link
Member

bittner commented Apr 4, 2025

@copilot Fix the pipeline in a separate PR! 🤣

@basola21
Copy link
Author

basola21 commented Apr 4, 2025

seems like this did not do the trick, try chat gpt maybe ?

@basola21 basola21 marked this pull request as draft April 4, 2025 07:06
@bittner bittner changed the title added the content square docs,template tag and tests Add ContentSquare (template tag, tests and docs) Apr 4, 2025
@bittner
Copy link
Member

bittner commented Apr 4, 2025

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.

@bittner
Copy link
Member

bittner commented Jul 8, 2025

Can you now rebase your PR? The pipeline should now pass.

@bittner
Copy link
Member

bittner commented Oct 8, 2025

@basola21 Please rebase this PR. The pipeline is now fixed.

@basola21 basola21 force-pushed the feat/Content-Square-Itegration branch from 6c38812 to d014859 Compare November 26, 2025 23:30
@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

❌ Patch coverage is 97.60000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.63%. Comparing base (6e367cd) to head (21942c7).
⚠️ Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
analytical/templatetags/mixpanel.py 50.00% 2 Missing ⚠️
analytical/templatetags/chartbeat.py 66.66% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@basola21 basola21 marked this pull request as ready for review November 27, 2025 00:34
@basola21
Copy link
Author

@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

@basola21 basola21 force-pushed the feat/Content-Square-Itegration branch from 21942c7 to fafe73a Compare November 27, 2025 00:38
@basola21 basola21 requested a review from Copilot November 27, 2025 00:41
Copilot finished reviewing on behalf of basola21 November 27, 2025 00:42
Copy link

Copilot AI left a 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.

Comment on lines +13 to +21
(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);
Copy link

Copilot AI Nov 27, 2025

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.

Suggested change
(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);
})();

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +24
<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);
Copy link

Copilot AI Nov 27, 2025

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.

Suggested change
<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);
})();

Copilot uses AI. Check for mistakes.

def test_contribute_to_analytical(self):
"""
`contentsquare.contribute_to_analytical` registers the head and body nodes.
Copy link

Copilot AI Nov 27, 2025

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."

Suggested change
`contentsquare.contribute_to_analytical` registers the head and body nodes.
`contentsquare.contribute_to_analytical` registers the head_bottom node.

Copilot uses AI. Check for mistakes.
Comment on lines 27 to +28
'analytical.hotjar',
'analytical.contentsquare',
Copy link

Copilot AI Nov 27, 2025

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.

Suggested change
'analytical.hotjar',
'analytical.contentsquare',
'analytical.contentsquare',
'analytical.hotjar',

Copilot uses AI. Check for mistakes.
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.

3 participants