LemonPI Soft Landing Helper
Easily create LemonPI dynamic soft landings on webpages, based on URL query string context, by automatically executing conditions for each content field.
Install
npm install --save lemonpi-soft-landing-helper
Usage
; ;
Or directly in the browser:
API
create(Object)
content
(object
offunction
values, required)...
(function
) The key has to match with a preexisting content field in LemonPI. Use thevalue
argument to do something with the dynamic content result for this field.
templateId
(number
, required) The template ID derrived from LemonPI.adsetId
(number
, required) The adset ID derrived from LemonPI.urlTest
(regex
) Only initialize when this regular expression matcheswindow.location.href
.interval
(number
, default:100
) The delay between execution attempts in milliseconds.debug
(boolean
, default:/lemonpi_debug/i.test(window.location.href)
) Enables console debugging.context
(function
returning anobject
, default:() => ({ 'query-parameters': getUrlQueryParameters() })
)
getUrlQueryParameter(String)
(string
)
Retrieves a query string parameter value from the URL. E.g. "http://www.example.com/?foo=bar"
→ getUrlQueryParameter('foo')
returns "bar"
.
getUrlQueryParameters()
(object
of string
values)
Retrieves all query string parameters from the URL.