Skip to content

CAPI tag throws error if conversionValue is undefined #14

@luukfiets

Description

@luukfiets

Hi @SurendraJambe / @SurendraJambeLI / @desaip / @wyattr,

There is an error in the tag template. If you're not supplying the tag with a conversion value, the tag will throw an error because it's trying to parse data.conversionValue which is undefined. The JSON.parse(data.conversionValue) will then throw an error saying: "undefined" is not valid JSON.

Even though the line of code uses an or statement, it still throws an error as the JSON.parse can't parse the undefined value and then throws an error.

The relevant line: https://github.com/linkedin-developers/linkedin-capi-tag-template/blob/main/template.tpl#L264

This could be solved by adding a try catch. Please let me know if you'd like me to make a PR.

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