URL parameters
Enable url query parameters to make use cases like campaign links easy.
For example, [email protected] will bypass the email gate window prior to viewing the document.
Other query parameters:
- page number: to direct people to the exact page you want them to view
@mfts Can you please explain , where exactly you want this feature to be built? Better some video referencing it. I want to work on this issue.
@Raju-kadel-27 the url parameters to the document view link.
currently I have papermark.io/view/ci123duer74333 and with url params i will have papermark.io/view/[email protected]
this url param should be configured in the link settings.
For example, in the link settings the user should set a particular merge tag which will be in the url_params {{invitee_email}} will be the merge tag for a campaign or something else where you'd like to segment the visitors by email.
the link would then be ``papermark.io/view/ci123duer74333?email={{invitee_email}}`
@mfts Thanks for the info !! Will definitely raise a PR after the fix !!!
@mfts adding merge tag feature should be enabled for email protected links only ?? or for every links that user can create ?
We can create the merge tags (url params) for every link.
We need to think if we want to force the user into a particular url parameter name email or keep if flexible so that the user can store any information in a link like external_id
@mfts How I can get userEmail when unknown user visit this link ?? ``papermark.io/view/ci123duer74333?email={{invitee_email}}` . I mean what is the logic behind retrieving userEmail automatically for any cases ? Can you please explain ? Sorry for my poor involvement.
@mfts I have seen, there is logic to get userEmail via ---> const { email: userEmail, id: userId } = (session?.user as CustomUser) || {};...But, when someone paste this link in their pc...userEmail will always be undefined ? Right ?
We can create the merge tags (url params) for every link.
We need to think if we want to force the user into a particular url parameter name
external_id
I suggest we use a combination of both. We can provide a list of primitive url_params which can also change the behavior of system.
Primitive url_params
Let's say if email url_param is turned on via configuration, the viewer would receive a custom link by the user containing their email as in papermark.io/view/[email protected]
How the user is going to create this custom link is another story. Maybe he/she would launch a campaign somewhere or manually append the email on the provided link papermark.io/view/ci123duer74333 for each individual.
The point is if the URL contains the email param the system will skip the email access view (maybe after email validation, and ) if it was in place.
page
Same as email, if URL contains page param, the viewer would see this page initially instead of lets say the first page.
Custom url_params
Here comes the other type or url_params. I think system can not do much about these custom url_params and it would only collect the number of visits per custom URL and display to the user.
NOTE: I have not used the merge_tag word as I think the url_param is more suitable and merge_tag functionality is a bit different than what we want to do here. Further explanation is appreciated. I am looking at the code after a while and making sense of use cases 😅
EDIT: I think I get why merge_tag is used in this discussion. It is in the context of how users can distribute the link. E.g they can run an email campaign that could use the link with merge_tag as papermark.io/view/ci123duer74333?email={{userEmail}} but once the link is clicked the URL would be papermark.io/view/[email protected] so for our system it won't be a merge_tag but a simple queryparam...
Thanks for chiming in @HunnySajid
Let's say if email url_param is turned on via configuration, the viewer would receive a custom link by the user containing their email as in
papermark.io/view/[email protected]
This is correct.
@ashrafchowdury has implemented a similar procedure for page number already by appending ?p=3 to deep-link into page three of the document.
Adding a ?email= URL parameter should be fairly straightforward now since we added email authentication, we are already getting the url param for email in the link
https://github.com/mfts/papermark/blob/6a2a8c256d23699deb67206af2b0c88e65b68df3/pages/view/%5BlinkId%5D/index.tsx#L105-L106
Currently this parameter is used together with the (verification)token in /api/views endpoint to validated the viewer, but this function can be modified to pass the email and load the document.
Additionally, we can prevent spam but explicitly enabling this behaviour in the link settings
regarding merge_tags
they can run an email campaign that could use the link with merge_tag as papermark.io/view/ci123duer74333?email={{userEmail}} but once the link is clicked the URL would be papermark.io/view/[email protected] so for our system it won't be a merge_tag but a simple queryparam...
Yes that's correct, our system would only see the ?email={{email}} url param. The merge_tag "default" value (if different from email) could be set in the link settings as well