listmonk icon indicating copy to clipboard operation
listmonk copied to clipboard

Taking stats from previous campaign

Open roshanjonah opened this issue 5 years ago • 13 comments

When we create a new draft campaign, it seems to contain stats from the previous campaign.

Campaigns___Email_It_App

It looks like a minor bug

roshanjonah avatar Mar 10 '21 22:03 roshanjonah

Unfortunately, it seems to be doing that even after sending the campaign through... it's carrying on Opens from the previous send...

Campaigns___Email_It_App

roshanjonah avatar Mar 10 '21 23:03 roshanjonah

Whoa! Can you list out the exact steps? Did you create a fresh campaign or clone? Were both running at the same time? What finished first? etc ...

knadh avatar Mar 11 '21 06:03 knadh

An alternative explanation is these are views from previews. I was about to open an issue about that as it seems that previews trigger the view pixel and as a campaign may go through many iterations could rack up quite a lot of views before sending out.

Screenshot 2021-03-11 at 10 40 56 PM

BenBao93 avatar Mar 11 '21 21:03 BenBao93

Yes, each time I click the preview button, the number increases! When I clone the campaign, the numbers don't seem to be carrying through but they did for the first campaign. Not sure how that might have happened.

roshanjonah avatar Mar 11 '21 22:03 roshanjonah

The preview is meant to be an accurate render of exactly what's meant to be sent, including link and view tracking. To avoid counting stats, the preview will have to not render those URLs, which is problematic. Or there has to be a mechanism where those endpoints detect that the click/views are coming from a preview mode and not register them. But, that's also tricky.

knadh avatar Mar 12 '21 05:03 knadh

@knadh right, maybe the most straight forward would be to disregard based on referrer or IP of the active admin session. Referrer should be easiest since the preview is hosted under the app domain.

BenBao93 avatar Mar 12 '21 08:03 BenBao93

based on referrer

Unreliable as the behaviour differs based on the client/browser.

IP of the active admin session

Not possible to guarantee accurate IP behind proxies, corporate networks, VPNs etc. Corporate networks will have the same IP for countless users. Admins and e-mail recipients within a company, thus, will have the same IP. The link/view endpoints are public and not connected to the admin session either.

The simplest thing would be to inject a ?preview=true, but than that's leaving a public backdoor. I'm not sure if this is a big enough issue that should be addressed right now.

knadh avatar Mar 12 '21 09:03 knadh

The preview to me is to see if the email looks as intended (design-wise). If we can remove click and view tracking from the preview completely. This issue is sorted.

If people want to see whether view and click tracking are working, they can always send a test campaign. That's just my opinion mate!

roshanjonah avatar Mar 12 '21 10:03 roshanjonah

If we can remove click and view tracking from the preview completely. This issue is sorted.

No straight forward way of doing this, is the issue :) Will explore what can be done.

knadh avatar Mar 12 '21 10:03 knadh

Ah got you. Maybe snapshotting and presenting preview as an image is one idea.

Well in that case, as you said, this isn't a pressing issue, and who doesn't like seeing more opens/clicks even if they are your own ;)

roshanjonah avatar Mar 12 '21 11:03 roshanjonah

Definitely not the most pressing issue. One alternative that I thought of would be maybe to set a short lived cookie when the preview is triggered that has the campaign UUID value and disables the tracking rendering (or counting). That would be hard to use by a 3rd party to mess with the trackers and be fairly compatible with the existing system.

BenBao93 avatar Mar 13 '21 11:03 BenBao93

How about passing an extra arguement to TemplateFuncs or CompileTemplate to stop rendering TrackLink, TrackView etc kind of keywords when it's called from any preview handler?

kousikmitra avatar Apr 20 '21 15:04 kousikmitra

This is done: https://github.com/knadh/listmonk/commit/37824136c07a140af405ea071dbf5ea24d8d5bbf

There was a far simpler way to achieve this. Simply replace the campaign UUID with a dummy value in the preview!

knadh avatar Apr 21 '21 10:04 knadh