Skip to content

howxm/howxm-js

Repository files navigation

howxm-js

Adds Howxm capabilities to your project

NPM JavaScript Style Guide npm downloads

Install

npm install --save howxm-js

Publish

npm run release
git push --follow-tags origin master && npm publish

Usage

  • Initializing Howxm
import React from 'react'
import { initHowxm } from 'howxm-js'

const myLogger = console.info

const HowxmReadyApp = () => {
  const appId = '<Your App ID>'

  useEffect(() => {
    initHowxm(appId, myLogger)
  }, [])

  return <App />
}
import React from 'react'
import { identifyHowxm } from 'howxm-js'

const myLogger = console.info

const MyCustomComponent = () => {
  const customerInfo = {
    uid: '00000001', // 用户唯一ID, 默认字段, 必填,string 类型
  }

  const handleUserInfo = (userInfo) => {
    identifyHowxm(customerInfo)
  }
}
import React from 'react'
import { checkOpenHowxm } from 'howxm-js'

const myLogger = console.info

const MyCustomComponent = () => {
  const campaignId = '<You Campaign ID>'
  const uid = '00000001'

  const handlecCheckOpenCampaign = () => {
    checkOpenHowxm(
      campaignId,
      customerInfo,
      () => {
        myLogger('checkOpenHowxm success')
      },
      (data) => {
        myLogger('checkOpenHowxm faield', data)
      }
    )
  }
}
import React from 'react'
import { openHowxm } from 'howxm-js'

const myLogger = console.info

const MyCustomComponent = () => {
  const campaignId = '<You Campaign ID>'
  const customerInfo = {
    uid: '00000001', // 用户唯一ID, 默认字段, 必填,string 类型
  }
  const extra = {
    plan: 'free',
  }

  const handleOpenCampaign = () => {
    openHowxm(campaignId, customerInfo, extra, () => {
      myLogger('openHowxm finished')
    })
  }
}
import React from 'react'
import { eventHowxm } from 'howxm-js'

const myLogger = console.info

const MyCustomComponent = () => {
  const eventCode = '<event code>'
  const eventAttrs = {
    plan: 'free',
    age: 17,
  }

  const handleTriggerEvent = () => {
    eventHowxm(eventCode, eventAttrs, () => {
      myLogger('triggerEvent success')
    })
  }
}

License

MIT © jinshuju

更多信息,请查看我们的帮助文档

About

使用npm的方式集成浩客

Resources

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •