HearthSim / django-reflinks

Referral links implementation for Django
MIT License
15 stars 5 forks source link

self.next ReferralHit attribute producing DataError: value too long for type character varying(200) #2

Open YPCrumble opened 5 years ago

YPCrumble commented 5 years ago

One of my customers uses Hubspot for their referrals, which adds a tremendous amount of cruft to their tracking links. For instance, this is the automated link created by a HubSpot email to my home page (sanitized example which was originally 304 characters long):

example.com/?utm_campaign=some+string+here&utm_source=another_short_string&utm_medium=email&utm_content=123456789&_hsenc=100_CHARACTER_RANDOM_STRING&_hsmi=1234567

The default URLField length is 200 characters, and that gets taken up very quickly if a link has a 100 character random string as part of it.

What I've done to temporarily fix this is increase the max_length parameter of the ReferralHit.next URLField to 500 characters. I thought that perhaps stripping the query parameters from the self.next parameter on the ReferralHit model would be another solution. Any thoughts? I'd be happy to provide a PR if one is desired!

YPCrumble commented 5 years ago

Thinking about it, probably trimming the next parameter before storing the ReferralHit is a better idea - thoughts?