I am generating QR Codes and to keep it as clear as possible, I want a short URL, then expand to a full address + UTM or at least have Google Analytics understand.
QR Code payload:
https://example.com/as?q=A01
The website is on WP, so I can redirect to:
https://example.com/A-Subject?q=A01
What I am looking for is the next step: Having Google analytics understanding that:
- Source: Business card
- Medium: QR Code
- Campaign: 01
I have tried filters in GA => search and replace /?q=A01
with ?utm_source=cards&utm_medium=QRCode&utm_campaign=A01
Problem is that even if the active page is displayed with the correct URL, the UTM parameters are not used/understood by GA (source = (none) for example)
Any idea of what to do?
- Plugin in WP to rewrite URL?
- Javascript in WP to rewrite URL?
- GA ?
[edit] Doing a bit more research, I suspect the easiest would be to go through .htaccess and do some url rewritting on add_action
In my case, depending on the first letter of the parameter, I would have a few possible outputs: A = QR Code on a card => q=A01 would be rewritten into
utm_source=cards&utm_medium=QRCode&utm_campaign=A01
B = QR Code on a poster => q=B07 would be rewritten into
utm_source=poster&utm_medium=QRCode&utm_campaign=B07