Skip to content

ampersand sign converted into unicode when added to analytics config. #529

@milindmore22

Description

@milindmore22

Bug Description

A user reported on support forums that the & is being converted to Unicode character \u0026 when being added to the analytics config.

After disabling optimizer it did output correctly
add_filter( 'amp_enable_optimizer', '__return_false' );

Steps to reproduce
You can reproduce using the AMP plugin for WordPress, steps assuming that you have WordPress site with AMP plugin installed

Step 1 : Login as Admin
Step 2: Goto AMP->Settings->Analytics
Step 3: Enter the type as "test" (you can add anything as type was unknow from support topics)
Step 4: add JSON config as below

{
  "requests": {
    "custom_params": "cp1=test&cp2=test"
  },
  "vars": {
    "env": "-preproduction"
  },
  "triggers": {
    "trackConsent": {
      "on": "visible",
      "request": "impression"
    }
  }
}

Expected Output
Same output as entered in config.

Current Behaviour

{
  "requests": {
    "custom_params": "cp1=test\u0026cp2=test"
  },
  "vars": {
    "env": "-preproduction"
  },
  "triggers": {
    "trackConsent": {
      "on": "visible",
      "request": "impression"
    }
  }
}

Screenshot

Input Output
image image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions