Skip to content

[Bug]: Inconsistent data-category behavior #809

@Naatan

Description

@Naatan

Expected Behavior

data-category="!analytics" fires on each page load if consent was not given.

Current Behavior

data-category="!analytics" only fires the moment consent is refused, which is inconsistent because data-category="analytics" fires both when consent is given as well as on page load.

Steps to reproduce

<script
    type="text/plain"
    data-category="analytics">
    console.log("consent given");
</script>
<script
    type="text/plain"
    data-category="!analytics">
    console.log("consent not given")
</script>

Add the following to a page and load the page. First time (without any consent having been given or rejected) nothing will fire.

When consent is given the "consent given" string will log, and upon page refresh it will again log this string.

Now open preferences and reject consent. The "consent not given" will be logged, but upon reload nothing is logged.

Proposed fix or additional info.

Make data-category="!analytics" fire on page load. This supports the use case of wanting to run distinct logic on whether consent was given or not.

Version

3.1.0

On which browser do you see the issue?

Firefox

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageyet to be reviewed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions