Skip to content

Amazon Module #10

@DeepakAK47

Description

@DeepakAK47

I just noticed the latest and greatest has an issue with decoding the Amazon p.state. I've been using a major kludge for a few months that someone else might be able to improve on.

    var pState;
    // If p.state
    if (p && 'state' in p) {
        var isAmazon = p.state.match("amazon"); // p was returning p.network
        if(isAmazon){
            pState = decodeURIComponent(escape(p.state)),
            pState = pState.replace(/"/g, "\"");
        }else{
            pState = p.state;
        }
        // Remove any addition information
        // E.g. p.state = 'facebook.page';
        try {
            var a = JSON.parse(pState);
            _this.extend(p, a);
        }
        catch (e) {
            console.error('Could not decode state parameter');
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions