- Notifications
You must be signed in to change notification settings - Fork3
Link google analytics or google tag manager from grapesjs settings
License
NotificationsYou must be signed in to change notification settings
Ju99ernaut/grapesjs-ga
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Easily link to your google analytics or google tag manager
<linkhref="https://unpkg.com/grapesjs/dist/css/grapes.min.css"rel="stylesheet"><scriptsrc="https://unpkg.com/grapesjs"></script><scriptsrc="https://unpkg.com/grapesjs-ga"></script><divid="gjs"></div>
consteditor=grapesjs.init({container:'#gjs',height:'100%',fromElement:true,storageManager:false,plugins:['grapesjs-ga'],});
body,html {margin:0;height:100%;}
- Plugin name:
grapesjs-ga
- Components
gtm
ga
- Blocks
gtm-block
ga-block
Option | Description | Default |
---|---|---|
gtmId | value from google tag manager dashboard |
|
gtmLabel | label for google tag manager block | Tag Manager |
gtmCategory | category for google tag manager block | Google |
gtmBlock | options to extend google tag manager block | {} |
gtmComponent | options to extend google tag manager component model | {} |
gaId | value from google analytics dashboard |
|
gaLabel | label for google analytics block | Analytics |
gaCategory | category for google analytics block | Google |
gaBlock | options to extend google analytics block | {} |
gaComponent | options to extend google analytics component model | {} |
- CDN
https://unpkg.com/grapesjs-ga
- NPM
npm i grapesjs-ga
- GIT
git clone https://github.com/ju99ernaut/grapesjs-ga.git
Directly in the browser
<linkhref="https://unpkg.com/grapesjs/dist/css/grapes.min.css"rel="stylesheet"/><scriptsrc="https://unpkg.com/grapesjs"></script><scriptsrc="path/to/grapesjs-ga.min.js"></script><divid="gjs"></div><scripttype="text/javascript">vareditor=grapesjs.init({container:'#gjs',// ...plugins:['grapesjs-ga'],pluginsOpts:{'grapesjs-ga':{/* options */}}});</script>
Modern javascript
importgrapesjsfrom'grapesjs';importpluginfrom'grapesjs-ga';import'grapesjs/dist/css/grapes.min.css';consteditor=grapesjs.init({container :'#gjs',// ...plugins:[plugin],pluginsOpts:{[plugin]:{/* options */}}// orplugins:[editor=>plugin(editor,{/* options */}),],});
Clone the repository
$ git clone https://github.com/ju99ernaut/grapesjs-ga.git$cd grapesjs-ga
Install dependencies
$ npm i
Start the dev server
$ npm start
Build the source
$ npm run build
MIT