Skip to content

Bessamu/amo-utm-parser-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utm Parser для AmoCRM

Установка (Install)

yarn add amo-utm-parser-js 
# or
npm install amo-utm-parser-js 

Использование (Usage)

Добавление в форму (add in form)

someFile.js

import amoUtmParser from 'amo-utm-parser-js'

window.onload = function () {
  amoUtmParser.init()
  
  var someForm = document.getElementById('some-form')
  someForm.addEventListener('submit', function (e) {
    amoUtmParser.addHiddenInputsInForms(e.srcElement)
    //
    // sending form or some another code
    //
  })
}

Или передача данных (or just send data)

someAnotherFile.js

import axios from  'axios'
import amoUtmParser from 'amo-utm-parser-js'

window.onload = function () {
  amoUtmParser.init()
  //
  // Some code
  //
      
  axios.post('/some-api', {
    utmData: amoUtmParser.getAmoUtms(),
  })
  
  //
  // Some code
  //
}

Можно инициализировать пакет async (you can init package async)

import amoUtmParser from 'amo-utm-parser-js'
amoUtmParser.asyncInit()

Events

After package init dispatch event AmoUtmParserInit