1.1.0 • Published 7 years ago

cc-calculator-widget v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Cool Climate Calculator Widget

This widget can be used to embed the Cool Climate Calculator UI in your site.

Installation

Make sure the following packages are installed on your machine

  • node.js
  • npm

Install dependencies

$ npm i

Production build

Compile into a minified bundle with external stylesheets.

$ gulp build

Development

Watch for changes:

$ gulp watch

Usage

The compiled bundle needs to be referenced within the HTML file.

<script charset="utf-8" src="dist/bundle.min.js"></script>

A div including the id tag (equivalent to the container_id parameter) needs to be created within the body tag.

The widget can be instantiated within a <script> tag. (for an example, see: dist/index.html )

<script>
new window.Widget({
    container_id: 'widget_goes_here',
    source: 'nature.org',
    campaign: 'carboncalculator',
    user_platform: false,
    banner_url: "https://clipartion.com/wp-content/uploads/2016/03/green-banner-transparent-png-image.png",
    banner_style: {'maxHeight': '60px'},
    cta: {
      title: 'Offset your impact on nature',
      show_equation: true,
      description: 'Your support will fund forest conservation and help reduce or slow the worst consequences of climate change.',
      carbon_price_per_ton: 45,
      offset_url: 'http://www.nature.org/offset',
      button_title: 'Offset now!'
    }
  });
</script>

Parameters

The UI of the CC Calculator is currently set to: http://calculator.coolclimatenetwork.net/

propertydescription
container_idThe identifier for the container which the iframe is inserted into.
sourceString to set utm_source on iframe URL parameter for Google Analytics.
campaignString to set utm_campaign on iframe URL parameter for Google Analytics.
user_platformBoolean which can be set to false in order to hide Settings menu item and disable connection to user platform (optional).
banner_urlSet the URL of the top banner image for the calculator.
banner_styleSet the style of the banner image within the the calculator (ie so you can position it properly) - expects an object.
max_widthSets maximum width of iframe. If not given, defaults to '1200px'.
heightSets height of iframe. If not given, updates responsively.
cta: {The following parameters need to be placed within this 'cta' object property.
titleThe title that shows up above the offset section on the Take Action page.
show_equationBoolean which decides whether the monthly gift equation is shown.
descriptionSets the description text displayed above the CTA button.
carbon_price_per_tonThe carbon price per ton for calculating the offset amount.
offset_urlThe URL that the call to action button is linked to.
button_titleThe text on the call to action button.
}
1.1.0

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago