A developer from down under (Australia) contributed to my open-source gem, Universal Track Manager. Thanks to a fellow who goes by github/sstrumph, you can now extend Universal Track Manager to track any kind of inbound field (beyond just the standard 5: utm_campaign, utm_term, utm_source, utm_ content, utm_term).
Now published: v0.7.0 of Universal Track Manager.
You can learn more about the gem, what you can use it for, if it's legal & ethical (spoilers: maybe not!) on the "README" page here on Github:
or get more info on my website
Universal Track Manager, also known as UTM, is a gem to track your visitors and their pageloads. You can use it to track Urchin Tracking Module (UTM) parameters, and the fact that these two things abbreviate to the same letters is play-on-words.
You can use Universal Track Manager to track simple information like browser, IP address, http referrer, and your inbound UTM (Urchin Tracking Module) parameters. Because UTM parameters are used most commonly with advirtising, we also refer to tracking your UTM parameters as “ad campaigns” or just “campaigns”.
In particular, this Gem can be used to solve the common first-land problem where UTM parameters are present only in the first page of a user’s visit, but not available naturally a few steps later when the event you want to track happens (see ‘UTM Hooks’)
Visits are a lot like Rails sessions; in fact, this Gem piggybacks off of Rails sessions for tracking the visit. (You will need to have a session store set up and in place.)
However, visits are not identical to sessions. More than one visit can have been created from the same session.
A session will have only one visit at a time. If a new visit event happens within an existing session, like the user returns in the same browser the following day, the old visit gets evicted from the session and a link between the newly created visit and old visit is maintained in the visits table.
Is this Ethical?
It is important to understand there are many different data points can could possibly be collected in today’s web traffic. You may use this gem at your own discretion, and you can choose either more or less data capturing, as well ore more or less data integration with your users.
The reason I underscore this point is that the safest data is anonymized data.
The general Rails best practice for the last decade has been to keep only session data with the user, but anonymize identifying data (like IP, behavior, browser), which could be used to identify individual users.
Please see the section ‘Granularity of Data Capture’ to understand the many different levels of (non-)privacy you may choose as the website operators.
Is this Legal?
In any country or region where a privacy law like the GDPR or California Consumer Privacy Act is in effect, getting informed consent to track this information is just one part of what you must do to comply with the law.
Most privacy laws regulate the usage, storage, transmission, and removal of this data once you are retaining it in your database as well.
This gem express captures this data, as described in this README document, and by using this gem you are responsible for complying with the appropriate laws and regulations subject to you.
Please consult a legal expert familiar with the laws of your region regarding data retention and capture if you are going to use this gem.
Jason Fleetwood-Boldt is runs the consulting agency VERSO COMMERCE. We can help you with site speed, analytics, competitive research, Wix, Shopify, React, or NextJS/Node apps. Get in touch today at https://versocommerce.com
more at his blog at https://jasonfleetwoodboldt.com