✨(tracking) add UTM parameters to shared document links
Add utm_source=docssharelink and utm_campaign={docId} query parameters
to shared document links (copy link and invitation emails).
Signed-off-by: Chaïb Martinez <chaibax@gmail.com>
This commit is contained in:
committed by
Anthony LC
parent
fa0c3847e4
commit
c0994d7d1f
@@ -8,6 +8,7 @@ and this project adheres to
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
- ✨(tracking) add UTM parameters to shared document links
|
||||||
- ✨(frontend) Can print a doc #1832
|
- ✨(frontend) Can print a doc #1832
|
||||||
- ✨(backend) manage reconciliation requests for user accounts #1878
|
- ✨(backend) manage reconciliation requests for user accounts #1878
|
||||||
- 👷(CI) add GHCR workflow for forked repo testing #1851
|
- 👷(CI) add GHCR workflow for forked repo testing #1851
|
||||||
|
|||||||
@@ -1260,7 +1260,7 @@ class Document(MP_Node, BaseModel):
|
|||||||
"brandname": settings.EMAIL_BRAND_NAME,
|
"brandname": settings.EMAIL_BRAND_NAME,
|
||||||
"document": self,
|
"document": self,
|
||||||
"domain": domain,
|
"domain": domain,
|
||||||
"link": f"{domain}/docs/{self.id}/",
|
"link": f"{domain}/docs/{self.id}/?utm_source=docssharelink&utm_campaign={self.id}",
|
||||||
"link_label": self.title or str(_("Untitled Document")),
|
"link_label": self.title or str(_("Untitled Document")),
|
||||||
"button_label": _("Open"),
|
"button_label": _("Open"),
|
||||||
"logo_img": settings.EMAIL_LOGO_IMG,
|
"logo_img": settings.EMAIL_LOGO_IMG,
|
||||||
|
|||||||
@@ -1021,7 +1021,10 @@ def test_models_documents__email_invitation__success():
|
|||||||
f"Test Sender (sender@example.com) invited you with the role "editor" "
|
f"Test Sender (sender@example.com) invited you with the role "editor" "
|
||||||
f"on the following document: {document.title}" in email_content
|
f"on the following document: {document.title}" in email_content
|
||||||
)
|
)
|
||||||
assert f"docs/{document.id}/" in email_content
|
assert (
|
||||||
|
f"docs/{document.id}/?utm_source=docssharelink&utm_campaign={document.id}"
|
||||||
|
in email_content
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@@ -1051,10 +1054,18 @@ def test_models_documents__email_invitation__url_app_param(email_url_app):
|
|||||||
|
|
||||||
# Determine expected domain
|
# Determine expected domain
|
||||||
if email_url_app:
|
if email_url_app:
|
||||||
assert f"https://test-example.com/docs/{document.id}/" in email_content
|
expected_url = (
|
||||||
|
f"https://test-example.com/docs/{document.id}/"
|
||||||
|
f"?utm_source=docssharelink&utm_campaign={document.id}"
|
||||||
|
)
|
||||||
|
assert expected_url in email_content
|
||||||
else:
|
else:
|
||||||
# Default Site domain is example.com
|
# Default Site domain is example.com
|
||||||
assert f"example.com/docs/{document.id}/" in email_content
|
expected_url = (
|
||||||
|
f"example.com/docs/{document.id}/"
|
||||||
|
f"?utm_source=docssharelink&utm_campaign={document.id}"
|
||||||
|
)
|
||||||
|
assert expected_url in email_content
|
||||||
|
|
||||||
|
|
||||||
def test_models_documents__email_invitation__success_empty_title():
|
def test_models_documents__email_invitation__success_empty_title():
|
||||||
@@ -1085,7 +1096,10 @@ def test_models_documents__email_invitation__success_empty_title():
|
|||||||
"Test Sender (sender@example.com) invited you with the role "editor" "
|
"Test Sender (sender@example.com) invited you with the role "editor" "
|
||||||
"on the following document: Untitled Document" in email_content
|
"on the following document: Untitled Document" in email_content
|
||||||
)
|
)
|
||||||
assert f"docs/{document.id}/" in email_content
|
assert (
|
||||||
|
f"docs/{document.id}/?utm_source=docssharelink&utm_campaign={document.id}"
|
||||||
|
in email_content
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_models_documents__email_invitation__success_fr():
|
def test_models_documents__email_invitation__success_fr():
|
||||||
@@ -1120,7 +1134,10 @@ def test_models_documents__email_invitation__success_fr():
|
|||||||
f"Test Sender2 (sender2@example.com) vous a invité avec le rôle "propriétaire" "
|
f"Test Sender2 (sender2@example.com) vous a invité avec le rôle "propriétaire" "
|
||||||
f"sur le document suivant : {document.title}" in email_content
|
f"sur le document suivant : {document.title}" in email_content
|
||||||
)
|
)
|
||||||
assert f"docs/{document.id}/" in email_content
|
assert (
|
||||||
|
f"docs/{document.id}/?utm_source=docssharelink&utm_campaign={document.id}"
|
||||||
|
in email_content
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock.patch(
|
@mock.patch(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const useCopyDocLink = (docId: Doc['id']) => {
|
|||||||
|
|
||||||
return useCallback(() => {
|
return useCallback(() => {
|
||||||
copyToClipboard(
|
copyToClipboard(
|
||||||
`${window.location.origin}/docs/${docId}/`,
|
`${window.location.origin}/docs/${docId}/?utm_source=docssharelink&utm_campaign=${docId}`,
|
||||||
t('Link Copied !'),
|
t('Link Copied !'),
|
||||||
t('Failed to copy link'),
|
t('Failed to copy link'),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user