A client uses the Hubspot consent banner on their website. We have implemented the Piwik Pro script directly into the website code and disabled the Piwik consent manager.
How do I manage the Piwik Pro tracking trigger with the HubSpot consent manager?
I have added the triggers below:
Page view with condition if cookie “__hs_initial_opt_in” = true (OK)
OR History change (SPA) with condition if cookie “__hs_initial_opt_in” = true ( Not working)
Piwik Pro tracking only works when the page reloads.
Is there dataLayer event sent with accepting cookies consent? Maybe add this one as well + cookie=true. Right now you are sending first entry page view with cookie=true (which is false), and then sending first page view on history change.
A trigger for the tag above that will fire on each page view where the cookie you’ve mentioned had value true.
Each new visitor is seen as anonymous by default so only after triggering this tag they will be seen as not anonymous.
With this kind of set-up you don’t have to worry about the additional condition for cookie value in each trigger you use, you simply set tags that you don’t want to fire for anonymous users as “consent type: analytics” and tags for every visitor “consent type: No consent is required”
In case you don’t want to track anything from anonymous users, than in administration > [site or app] > privacy you also change this:
This solution might take some time to set-up correctly and debug to make sure everything works as expected, so you might consider workaround of @Jakub_Fidala.
This tag should fire only when visitor give a consent. By the description of the situation, it sounds to me like the trigger is fired immidietly on the page, which by the look of the trigger (page load), I think is true. You have to use a cookie value that is only true once consent is given (or a cookie that is created only when consent is given).
The cookie (“__hs_initial_opt_in”) I’m relying on for the trigger is only true when the user consent.
I have sent you the site as a message. Can you please check it?
Thanks
That’s correct, you should see it, as the current script you have should fire before consent is given. Because you are using a listener that waits for a decision. So the consent itself is not changed until listener sees the hubspot event.
What I’ve noticed is missing part of the script.
you need to have two functions at the end of set compliance settings. They are there for debugging purpose so I leave those empty but they are still required.
So instead of this:
Other thing is you are changing status for -1 for not consenting visitors. You should use 0, as -1 is interpreted as visitors who didn’t made decision yet. From the data gathering point there is no difference as Piwik PRO considers not consenting and those who didn’t made a decision yet as the same. But the proper way is to have 0 once someone doesn’t consent.
And last thing, when opening site as a new visit, I still don’t see our consent cookie, so please take a look at this issue.