Show cookie consent on selected page

Hi, in case, if I want to show Cookie Consent dialog only on specific URL, is there a way to show it conditionally (only on select page or pages)?

What would be the behaviour on those where it’s not shown? I’d go with the CM JS api here. There are dedicated methods to save the consent decision as well as to simply display the form once again. There are also code samples available here.

So, we want to have 2 different behaviors.

  1. Pages without consent: analytics collects data as it is.
  2. Pages with consent: analytics supposes to collect data after user accept it.
    Is it possible to do with CM API?

Try to run the following code on pages where you’d like the consent to be applied automatically:

ppms.cm.api(
  "setInitialComplianceSettings",
  { consents: ["analytics"] },
  function () {},
  function () {}
);
ppms.cm.api(
  "setComplianceSettings",
  { consents: { analytics: { status: 1 } } },
  function () {},
  function () {}
);
document.getElementById('ppms_cm_consent_popup_<your site id>').style.display = "none";

But this will also store the consent decision globally for all other pages. Not sure what you’d like to achieve.

You can also do it the other way round. To open the consent form after the consents have been saved, you can use the following code:

ppms.cm.api('openConsentForm', function(){}, function(){});

Alternatively, you could install another container code on those sites that you’d like to track always. You configure this container to not require consent and add the custom async tag to start tracking data. Here you have example code: how to install analytics via custom tag.

For better understanding what I want to achieve:
We have an application where users can create landing pages and publish with unique URL. Then users can track analytics on that pages. On our app, PIWIK analytics installed globally, and we filter data by user id, org id etc. to show specific data for specific URL. And we want to have an option to add or remove cookie consent for each page user creates.
As I understood from your message above, it’s not really achievable?

Didn’t say that. There are multiple ways to configure it. I suggested a few, and hope those will be useful.