I wasn't sure where else to post this, I might try posting it with the plugins list page as well, but basically here's what I'm looking for:
When I use social marketing tools l like Buffer, Hootsuite, or even email marketing tools like Send.ly or MailChimp, they add marketing campaign info to the end of the URL and it would be great to be able to capture and count that. For instance:
I have a short link to an event website info page that I'm organizing that is something like https:\\link.mydomain.com\eventinfo and when I use a tool like the ones mentioned above that add things to the url link to keep track of the marketing campaign and where the link was posted, so the links end up getting posted like these:
This gives me the ability to tie together the exact places where links were originally posted, from what marketing tool, and were part of which "campaign", and for I frequently include the date and time in the compaign name like inviteround001_2016_06_30_1pm. It would be VERY helpfully to me, and I think to a lot of other people as well if YOURLS had a way to capture each query item added to the end of a shortlink and store it in a DB table maybe in rows or something that have row values of "shortlink", "query_parameter", "value", and "count", this way each and every one of those that comes in could be kept track of individually so I could always see how many people a particular campaign has reached, or what source is really leading in reachability. Especially because a lot of the times the referrer/traffic source info comes in as multiple locations even when they're from the same place, even worse with twitter where the shorten everything again with their t.co service and you get things like this:
m.facebook.com: 190 (details)
* http://m.facebook.com: 131
* http://m.facebook.com/: 49
* https://m.facebook.com/: 4
* https://m.facebook.com/l.php?u=https%3A%2F%2Fl.mydomain.com%2Fnye&h=0AQHBWizW&s=1: 3
* https://m.facebook.com/l.php?u=https%3A%2F%2Fl.mydomain.com%2Fnye&h=jAQFIlOMI: 1
www.facebook.com: 137 (details)
* https://www.facebook.com: 21
* https://www.facebook.com/: 103
* https://www.facebook.com/events/429490123492653/: 1
t.co: 9 (details)
* https://t.co/lRW81234CG: 7
* https://t.co/Y1234xv2RQ: 2
What do you guys think? Anyone up for the challenge? I'd write this myself if I was better in PHP, but to be honest I'm a terrible coder and the only thing I can really write anything in is python.
This is turning out to be a little LESS challenging than I though... I don't know much about PHP, so I'm learning as I got, but I'm writing the plugin myself. Right now it's in my privately hosted gitlab repo, but as soon as I get something mildly functional, I'll put it up here on github and if anyone would like to check my code and make it better where possible, and I'm sure it will be possible, that would be awesome!
So for I have an ACTION hook on "pre_redirect" that's grabbing the REQUEST_URI, splitting it up into pieces to I can see the shortcode and each query parameter and it's value, as well as check to see if there are any query items at all, and if not, just stop processing through the plugin completely.
Next thing I need to do is figure out how to get it to store a count in the DB, check to see if theres a row for that shortcode and that query parameter, if so, increase the count field by 1, if not insert that row.
Then on the plugin management page, but able to select every unique shortcode in the database and show under each one, all the query parameters sent through and their counts. I'm not exactly sure how to do all of that yet.... but I'm learning!
How would I add a plugin specific table or tables to the MySQL DB being used by YOURLS?
This plugin might be a good example to look into: https://github.com/YOURLS/YOURLS/wiki/Plugin-List#http-status-per-link
Generally speaking, lots of plugins can give you hints about how to do this or that
Yeah, I have been grabbing code from other plugins while creating my own as well... this one does have some great examples in it too, thanks for the heads up! I had found another way to do it, but this one is much better!