Archived topic
Quantcast Persistent link not working
14 replies · Started by Dimitrios on February 1, 2021
Hello there.
I recently installed Quantcast to my site for user consent.
I want to have a persistent link in the footer because it is required by law but for some reason, the code won't work.
HERE IS THE CUSTOM CODE: https://help.quantcast.com/hc/en-us/articles/360047084654-Allowing-Users-to-Change-Consents-Privacy-Settings-Button-TCF-v2-
Here is what I put on the footer: <a class="change-consent"
onclick="window.__tcfapi('displayConsentUi', 2, function() {} );">change consent
When I hit save and test it, it doesn't work. I am using this in another site without the GeneratePress theme and it works.
What I noticed is that after I have saved that, if I go again in the footer to see the code it is just
< style="cursor:pointer" class="change-consent">Update Privacy Settings > (I skipped the a tag because it makes it a link)
I don't know why but after saving it skips some code.
Any ideas on how to fix it? It is supposed to pop up a window when UPDATE PRIVACY SETTINGS is clicked so that the user can change their settings.
-Thanks
Hi there,
can you to try adding the code to a Footer Bar Widget not the Copyright information field.
Yes, it works as a Footer Bar Widget... Why isn't it working in the main footer? Can we please find a way so that it works in the main footer?
You can check it on my website. I have put both persistent links but only the one in the footer bar is working.
Isn't that kind of code allowed there? And how can we fix this?
The copyright field provides support for standard HTML. WP by default sanitizes HTML and strips any code it sees as a potential security risk. HTML Widgets have greater flexibility and allow admin users to include unfilteredHTMLl.
If you must add it to the Copyright info, then first you will need to create a Shortcode to output your link:
https://docs.generatepress.com/article/creating-a-shortcode/
Then add the shortcode to the copyright field.
Thanks a lot!!! I appreciate it!
You're welcome
Could you tell me how to implement the code inside the shortcode though?
add_shortcode( 'my_shortcode', function() {
ob_start();
// Start your PHP below
echo 'short code example';
// End your PHP above
return ob_get_clean();
} );
I WANT TO ADD THIS CODE INSIDE BUT IT SHOWS ERROR:
<a style="cursor:pointer" class="change-consent"
onclick="window.__tcfapi('displayConsentUi', 2, function() {} );">Update Privacy Settings
First off change the my_shortcode label here:
add_shortcode( 'my_shortcode', function() {
to whatever you require eg. consent_link
The echo statement is then what controls your output - i copied the HTML from your site to make sure it matches the working link:
echo '<a style="cursor:pointer" class="change-consent" onclick="window.__tcfapi(\'displayConsentUi\', 2, function() {} );">Update Privacy Settings</a>';
it shows the following errors https://ibb.co/D92qpdy
Any ideas?
Editing the above code
I did use the shortcode.... but it still doesn't work... Maybe take a look?
The code is okay without errors
add_shortcode( 'consent_link', function() {
ob_start();
// Start your PHP below
echo 'Update Privacy Settings';
// End your PHP above
return ob_get_clean();
} );
Grrr stoopid quotes lol
Try the updated (again) code above
Haha! It works now!
Thanks!
Awesome :) Glad to be of help.