[Resolved] Quantcast Persistent link not working

Home Forums Support [Resolved] Quantcast Persistent link not working

Home Forums Support Quantcast Persistent link not working

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1641388
    Jim

    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

    #1641449
    David
    Staff
    Customer Support

    Hi there,

    can you to try adding the code to a Footer Bar Widget not the Copyright information field.

    #1641455
    Jim

    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.

    #1641490
    Jim

    Isn’t that kind of code allowed there? And how can we fix this?

    #1641515
    David
    Staff
    Customer Support

    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.

    #1641555
    Jim

    Thanks a lot!!! I appreciate it!

    #1641664
    David
    Staff
    Customer Support
    #1641722
    Jim

    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

    #1641746
    David
    Staff
    Customer Support

    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>';

    #1641755
    Jim

    it shows the following errors https://ibb.co/D92qpdy

    Any ideas?

    #1641757
    David
    Staff
    Customer Support
    #1641764
    Jim

    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();
    } );

    #1641938
    David
    Staff
    Customer Support

    Grrr stoopid quotes lol
    Try the updated (again) code above

    #1641974
    Jim

    Haha! It works now!

    Thanks!

    #1642041
    David
    Staff
    Customer Support

    Awesome 🙂 Glad to be of help.

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.