UTM parameters in your qr code plugin
-
Hi.
Can you add posibility of using UTM parameters in your plugin?
-
I would like to know where users come from to my website: from offline marketing papers whith qr codes on them or from scanning a qr code on my website pages by a smartphone.
Hello @aliputin,
Thanks a lot for reaching out us. You can add UTM parameters to product permalink using
wcqrc_product_permalinkfilter.For reference use bellow code snippet in themes function.php file.
add_filter('wcqrc_product_permalink', 'wcqrc_product_permalink', 10, 2); function wcqrc_product_permalink($permalink, $product_id){ return $permalink . $utm_parameters; //where $utm_parameters is your product UTM parameters }For any further query / assistance please get in touch with us through [email protected]
Thanks and Regards,
BappaThank you.
And can you explain in detail how to do that and usewcqrc_product_permalinkfilter?Please use bellow code in your themes function.php file.
add_filter('wcqrc_product_permalink', 'wcqrc_product_permalink', 10, 2); function wcqrc_product_permalink($permalink, $product_id){ return $permalink . $utm_parameters; //where $utm_parameters is your product UTM parameters }Replace $utm_parameters variable with UTM Parameters.
Thanks and Regards,
BappaI created a file functions.php in the child theme folder, added the above code to this file, replaced
$utm_parametersvariable with UTM Parameters.
Do I do right? What else should I do?That’s all check if this works.
Thanks and regards,
BappaIt doesn’t work, unfortunately.
QR code scanner shows only a url without UTM Parameters.Give us the UTM Parameters which you want to include and we will give you the exact code.
Thanks and regards,
BappaDo you have refresh qr code of that product after applying the code? You can make it by clicking on refresh button on that product through admin back end.
Thanks and regards,
BappaYes, I refreshed the qr code.
Here is my utm:
?utm_source=qr-code&utm_medium=online_homedeco&utm_campaign=0001_&utm_content=0001_&utm_term=0001_Hi @aliputin,
Please use bellow updated code in your child theme function.php file and don’t forget to refresh the qr code of that product.add_filter('wcqrc_product_permalink', 'wcqrc_product_permalink', 10, 2); function wcqrc_product_permalink($permalink, $product_id){ $utm_parameters_args = array( 'utm_source'=> 'qr-code', 'utm_medium' => 'online_homedeco', 'utm_campaign' => '0001_', 'utm_content' => '0001_', 'utm_term' => '0001_' ); return esc_url(add_query_arg($utm_parameters_args, $permalink)); }Looking forward to your co-operation regarding the same.
Regards,
BappaThank you for helping.
It works now.Happy to hear from you that the customised code works.
Please give us 5/5 if you like this plugin.
Regards,
BappaAnother issue came out. After scanning a QR code, an ampersand sign
&in a url is converted into& #038;sign. And that doesn’t allow Google analytics to read variables (except the first variable).
For example, I expected:
mysite.com?utm_source=10&utm_medium=11&utm_campaign=12&utm_content=13&utm_term=14
In fact, I’ve got:
mysite.com?utm_source=10& #038;utm_medium=11& #038;utm_campaign=12& #038;utm_content=13& #038;utm_term=14Do you know how to fix it?
* & #038; without a space between & and #
Any suggestions?
The topic ‘UTM parameters in your qr code plugin’ is closed to new replies.