Skip to content

Instantly share code, notes, and snippets.

@malev
Created March 6, 2019 05:07
Show Gist options
  • Save malev/90cee5e12be39bfb50ded31438b610e3 to your computer and use it in GitHub Desktop.
Save malev/90cee5e12be39bfb50ded31438b610e3 to your computer and use it in GitHub Desktop.

Interface

/**
 * Adds a segment named `name`
 *
 * @param name {string}
 * @param options {object}
 * @param options.expiration {integer} timestamp
 * @param options.maxAge {integer} number of seconds before it expires
 */
window._segments.add(name, opts)
/**
 * Removes a segment named `name` 
 *
 * @param name {string}
 */
window._segments.remove('name')

Cookie

CN_Segments=prevf,expires=1552521600|tny-trial,expires=1552521600

Note: there is no ttl in the cookie. All ttl should be transformed into an expiration timestamp

@jshapira
Copy link

jshapira commented Mar 6, 2019

CN_Segments= { 
    prevf: {
        exp: 1552521600 
    },
    tny-trial: {
        exp: 1552521600 
    },
    intelligent-seg: {
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment