1.0.1 • Published 4 years ago

zygote-plugin-active-campaign v1.0.1

Weekly downloads
16
License
MIT
Repository
github
Last release
4 years ago

Zygote Plugin Active Campaign

This plugin is the integration of Zygote and Active Campaign

:construction: UNDER DEVELOPMENT :construction:


Installation

With npm:

npm install --save zygote-plugin-active-campaign

Or with Yarn:

yarn add zygote-plugin-active-campaign

What does the plugin do

On the preInfo hook:

  • Creates/Updates a contact resource
  • Creates/Updates eCommerce customer resource
  • Creates/Updates order with an abandoned cart flag

On the postOrder hook:

  • Updates the created abandoned cart order

Deep Data Integration

The plugin focuses on creating deep data integrations through Active Campaign

Deep Data Integration - Active Campaign


Configuration

On the index the same file that your Cart is being imported from Zygote, import the plugin:

import * as ZygoteAC from "zygote-plugin-active-campaign"

Inject the plugin in the cart:

<Cart
    plugins={[ZygoteAC]}
/>

On componentDidMount() initialize the AC plugin by sending in the configurations(view details below about the data expected):

componentDidMount() {
  ZygoteAC.init(config, devConfig, pluginConfig, defaultConfig, automationConfig)
}

Initialization Parameter objects description:

  1. config - Active Campaign account configuration specifications:

    Property NameData TypeDescription
    serviceNamestringName of the service
    serviceLogoUrlstringurl to logo of service
    proxyUrlstringurl that points to proxy
    originstringorigin of requests
    hoststringhosting site
    {
      serviceName: `MyCompanyOne`,
      serviceLogoUrl: `https://www.mycompanyone.com/media/logo.png`,
      proxyUrl: `https://www.mycompanyone.com/api/3/`,
      origin: `https://www.mycompanyone.com/`,
      host: `www.mycompanyone.com`,
    }
  2. devConfig - define sandbox url and set it to run on dev mode

    Property NameData TypeDescription
    proxyDevUrlstringurl for the sanbox account
    devOriginstringurl for the instance running dev
    isDevModebooleansets plugin to run on dev mode
    isLoggingbooleanenables built in console logs
    {
      proxyDevUrl: `https://mysandboxacct.netlify.com/dev/api/3/`,
      devOrigin: `https://mydevinstance.netlify.com`,
      isDevMode: true,
      isLogging: true
    }
  3. pluginConfig - displaying, styling and custom configurations of plugin

    Property NameData TypeDescription
    acceptsMarketingbooleanSet checkbox to start checked/unchecked
    colorstringHEX value of the checkbox
    textstringDisplay text for the opt-in
    hasFullImageUrlbooleanSet to true if products have a full url, else it will auto concat the site url or devurl if it is on isDevMode
    addAbandonedTagbooleanAutomatically adds an abandoned tag to the contact when a cart is abandoned, and removes it when the order is completed
    {
        acceptsMarketing: true,
        color: `#182A42`,
        text: `I would like to receive emails and updates about my order and special promotions`,
        hasFullImageUrl: true,
        addAbandonedTag: true
    }
  4. defaultConfig - default configurations for the plugin to run based on

    Property NameData TypeDescription
    abandonOffsetnumberOffset time in minutes from current time that a cart is flagged as abandoned
    {
        abandonOffset: 5
    }
  5. automationConfig - custom configuration for automations

    Property NameData TypeDescription
    clearAutomationsbooleanclear contact from all automations after checkout is completed
    {
        clearAutomations: true
    }

Proxy Setup

The Active Campaign API requires API requests to come from a proxy or a server.

For Netlify you can setup a proxy on your netlify.toml file (docs).

Add the following to your netlify.toml file:

[[redirects]]
  from = "/api/3/:params/:id/:subquery"
  to = "https://<account-name>.api-us1.com/api/3/:params/:id/:subquery"
  status = 200
  force = true
  [redirects.headers]
    Api-Token = "<AC-API-KEY>"

[[redirects]]
  from = "/api/3/:params/:id"
  to = "https://<account-name>.api-us1.com/api/3/:params/:id"
  status = 200
  force = true
  [redirects.headers]
    Api-Token = "<AC-API-KEY>"

[[redirects]]
  from = "/api/3/:params"
  to = "https://<account-name>.api-us1.com/api/3/:params"
  status = 200
  force = true
  [redirects.headers]
    Api-Token = "<AC-API-KEY>"

# Optional if you want to be able to run pointing to a Sand Box
[[redirects]]
  from = "/dev/api/3/:params/:id/:subquery"
  to = "https://<account-name>.api-us1.com/api/3/:params/:id/:subquery"
  status = 200
  force = true
  [redirects.headers]
    Api-Token = "<AC-SANDBOX-API-KEY>"

[[redirects]]
  from = "/dev/api/3/:params/:id"
  to = "https://<sandbox-account-name>.api-us1.com/api/3/:params/:id"
  status = 200
  force = true
  [redirects.headers]
    Api-Token = "<AC-SANDBOX-API-KEY>"

[[redirects]]
  from = "/dev/api/3/:params"
  to = "https://<sandbox-account-name>.api-us1.com/api/3/:params"
  status = 200
  force = true
  [redirects.headers]
    Api-Token = "<AC-SANDBOX-API-KEY>"

For additional info on Proxy setup on Netlify:

Netlify - Rewrites and Proxying

Netlify - Toml Reference


Additional Docs

:loudspeaker: Active Campaign Documentation

:shopping_cart: Zygote Cart Documentation

1.0.1

4 years ago

1.0.0

4 years ago

0.4.0

4 years ago

0.3.131

4 years ago

0.3.129

4 years ago

0.3.128

4 years ago

0.3.127

4 years ago

0.3.125

4 years ago

0.3.126

4 years ago

0.3.124

4 years ago

0.3.123

4 years ago

0.3.122

4 years ago

0.3.121

4 years ago

0.3.12

4 years ago

0.3.11

4 years ago

0.3.1

4 years ago

0.2.212

4 years ago

0.2.211

4 years ago

0.2.210

4 years ago

0.2.2

4 years ago

0.2.118

4 years ago

0.2.117

4 years ago

0.2.116

4 years ago

0.2.115

4 years ago

0.2.114

4 years ago

0.2.113

4 years ago

0.2.112

4 years ago

0.2.111

4 years ago

0.2.1

5 years ago

0.1.9999

5 years ago

0.1.9998

5 years ago

0.1.9997

5 years ago

0.1.9996

5 years ago

0.1.9995

5 years ago

0.1.9994

5 years ago

0.1.9993

5 years ago

0.1.9992

5 years ago

0.1.9991

5 years ago

0.1.9990

5 years ago

0.1.9989

5 years ago

0.1.9988

5 years ago

0.1.9987

5 years ago

0.1.9986

5 years ago

0.1.9985

5 years ago

0.1.9984

5 years ago

0.1.9983

5 years ago

0.1.9982

5 years ago

0.1.9981

5 years ago

0.1.9980

5 years ago

0.1.9979

5 years ago

0.1.9978

5 years ago

0.1.9977

5 years ago

0.1.9976

5 years ago

0.1.9975

5 years ago

0.1.9974

5 years ago

0.1.9973

5 years ago

0.1.9972

5 years ago

0.1.9971

5 years ago

0.1.997

5 years ago

0.1.996

5 years ago

0.1.995

5 years ago

0.1.994

5 years ago

0.1.993

5 years ago

0.1.992

5 years ago

0.1.991

5 years ago

0.1.99

5 years ago

0.1.98

5 years ago

0.1.97

5 years ago

0.1.96

5 years ago

0.1.95

5 years ago

0.1.94

5 years ago

0.1.93

5 years ago

0.1.921

5 years ago

0.1.92

5 years ago

0.1.91

5 years ago

0.1.90

5 years ago

0.1.89

5 years ago

0.1.88

5 years ago

0.1.87

5 years ago

0.1.86

5 years ago

0.1.85

5 years ago

0.1.84

5 years ago

0.1.83

5 years ago

0.1.82

5 years ago

0.1.81

5 years ago

0.1.80

5 years ago

0.1.79

5 years ago

0.1.78

5 years ago

0.1.77

5 years ago

0.1.76

5 years ago

0.1.75

5 years ago

0.1.74

5 years ago

0.1.73

5 years ago

0.1.72

5 years ago

0.1.71

5 years ago

0.1.70

5 years ago

0.1.69

5 years ago

0.1.68

5 years ago

0.1.67

5 years ago

0.1.66

5 years ago

0.1.65

5 years ago

0.1.64

5 years ago

0.1.63

5 years ago

0.1.62

5 years ago

0.1.61

5 years ago

0.1.60

5 years ago

0.1.59

5 years ago

0.1.58

5 years ago

0.1.57

5 years ago

0.1.56

5 years ago

0.1.55

5 years ago

0.1.54

5 years ago

0.1.53

5 years ago

0.1.52

5 years ago

0.1.51

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago