Whosoever embeds this library in a Picreel template, if he be worthy, shall possess the power to send emails to SailThru and track them using Lighthouse.
An Important Note on Semantic Versioning
This library attempts to follow the SemVer specification. Before deploying, be sure to update the library version in package.json
. This library will deploy to a semantically versioned path in the specified S3 bucket, so breaking changes will not affect previously deployed versions.
- Install Node.js
- Run
npm install
, which will install all necessary support libraries for testing building, and exporting - Copy
config/aws-config.json.example
toconfig/aws-config.json
and fill in with appropriate values.
If you don't have actual values for the config params, the example values may be left or changed simply to""
, and thegrunt aws
task simply won't complete.
- Follow the Environment Setup steps above
- Run
grunt
to build the libraries. If all tests pass, normal and minified libraries will be in the/build
directory.
- Follow the Environment Setup steps above
- Run
grunt test
- Follow the Environment Setup steps above
- Update the semantic version in
package.json
- Run
grunt deploy:production
. If all tests pass, normal and minified libraries will be uploaded to the S3 bucket specified inconfig/aws-config.json
along a semantically versioned path, and a matching CloudFront invalidation will be created.
Picreel doesn't do <form>
s, but it does do <input>
s. Let's say you had
- an email input
<input type="email" name="email">
- a submit input
<input type="button" id="submit-button">
- and a desire to submit the form to a custom Sailthru list, "STYLE"
In the editor you would place the following:
<script src="//my-cloudfront-dist-id.cloudfront.net/libs/picreel/0.4.0/picreel.min.js"></script>
<script>
if(window.jQuery){
jQuery(document).ready(function($) {
var params = {
submitSelector: "#submit-button",
emailSelector: "input[name='email']",
action: "https://www.mydomain.com/my_form_handler/",
list: "STYLE"
};
window.APLS = new APLSubscriber(params);
});
};
</script>
Sailthru [Vars](https://getstarted.sailthru.com/new-for-developers-overview/email-and-user-profiles/user/#POST Mode - Optional Parameters - vars 2) may added to templates and will be submitted as event vars and profile varswhen a user subscribes. All vars submitted will be made to equal the value 1.
Simply add an array of vars to the template editor, as in the following example:
<script src="//my-cloudfront-dist-id.cloudfront.net/libs/picreel/0.4.0/picreel.min.js"></script>
<script>
if(window.jQuery){
jQuery(document).ready(function($) {
var params = {
action: "https://www.mydomain.com/my_form_handler/",
list: "SUBSCRIBERS",
vars: ["giveaway", "example"]
};
window.APLS = new APLSubscriber(params);
});
};
</script>
Sailthru will accept any event name, but you will have to configure which event names have triggers in Sailthru.
For a custom event name, add it as a string:
<script src="//my-cloudfront-dist-id.cloudfront.net/libs/picreel/0.4.0/picreel.min.js"></script>
<script>
if(window.jQuery){
jQuery(document).ready(function($) {
var params = {
action: "https://www.mydomain.com/my_form_handler/",
list: "SUBSCRIBERS",
event: "my_event_name"
};
window.APLS = new APLSubscriber(params);
});
};
</script>
NOTE 1: Pireel's editor does not load jQuery, but we're dependent on jQuery. Therefore, be sure to wrap new APLSubscriber
declaration in if(window.jQuery)
NOTE 2: Most new APLS attributes may be specified when creating a new object. See lib/factories/subscriber.js
for what may be created as arguments