4 | Welcome to {{ title }}! 5 |
6 | 7 | 17 | 18 |21 |
├── src ├── assets │ └── .gitkeep ├── app │ ├── test-page-a │ │ ├── test-page-a.component.css │ │ ├── test-page-a.component.html │ │ ├── test-page-a.component.ts │ │ └── test-page-a.component.spec.ts │ ├── test-page-b │ │ ├── test-page-b.component.css │ │ ├── test-page-b.component.html │ │ ├── test-page-b.component.ts │ │ └── test-page-b.component.spec.ts │ ├── app.routes.ts │ ├── app.component.css │ ├── app.component.ts │ ├── app.providers.ts │ ├── app.component.spec.ts │ └── app.component.html ├── favicon.ico ├── styles.css ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── tsconfig.spec.json ├── tsconfig.app.json ├── main.ts ├── index.html └── jest.config.js ├── .eslintignore ├── projects └── ngx-google-analytics │ ├── src │ ├── lib │ │ ├── types │ │ │ ├── primitive.type.ts │ │ │ ├── data-layer.type.ts │ │ │ ├── gtag.type.ts │ │ │ └── ga-action.type.ts │ │ ├── tokens │ │ │ ├── ngx-google-analytics-window.ts │ │ │ ├── ngx-google-analytics-settings-token.ts │ │ │ ├── ngx-google-analytics-router-settings-token.ts │ │ │ ├── ngx-window-token.ts │ │ │ ├── ngx-data-layer-token.ts │ │ │ └── ngx-gtag-token.ts │ │ ├── interfaces │ │ │ ├── i-google-analytics-command.ts │ │ │ ├── i-google-analytics-sevice.ts │ │ │ ├── i-google-analytics-settings.ts │ │ │ └── i-google-analytics-routing-settings.ts │ │ ├── directives │ │ │ ├── ga-event-category.directive.spec.ts │ │ │ ├── ga-event-category.directive.ts │ │ │ ├── ga-event-form-input.directive.ts │ │ │ ├── ga-event-form-input.directive.spec.ts │ │ │ ├── ga-event.directive.ts │ │ │ └── ga-event.directive.spec.ts │ │ ├── ngx-google-analytics.module.ts │ │ ├── enums │ │ │ └── ga-action.enum.ts │ │ ├── ngx-google-analytics-router │ │ │ └── ngx-google-analytics-router.provider.ts │ │ ├── ngx-google-analytics.provider.ts │ │ ├── initializers │ │ │ ├── google-analytics.initializer.ts │ │ │ ├── google-analytics-router.initializer.ts │ │ │ └── google-analytics-router.initializer.spec.ts │ │ └── services │ │ │ ├── google-analytics.service.ts │ │ │ └── google-analytics.service.spec.ts │ ├── index.ts │ └── public_api.ts │ ├── ng-package.json │ ├── tsconfig.lib.prod.json │ ├── tsconfig.spec.json │ ├── jest.config.js │ ├── package.json │ └── tsconfig.lib.json ├── .vscode └── settings.json ├── e2e ├── src │ ├── app.po.ts │ └── app.e2e-spec.ts ├── tsconfig.e2e.json └── protractor.conf.js ├── .editorconfig ├── .gitignore ├── tsconfig.json ├── LICENSE ├── .github └── workflows │ ├── tests.yml │ └── publish.yml ├── .eslintrc.json ├── package.json ├── CHANGELOG.md ├── angular.json └── README.md /src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /src/app/test-page-a/test-page-a.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/test-page-b/test-page-b.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hakimio/ngx-google-analytics/HEAD/src/favicon.ico -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /projects/ngx-google-analytics/src/lib/types/primitive.type.ts: -------------------------------------------------------------------------------- 1 | export type Primitive = string | number | boolean | Date; 2 | -------------------------------------------------------------------------------- /src/app/test-page-a/test-page-a.component.html: -------------------------------------------------------------------------------- 1 |
2 | test-page-a works! 3 |
4 | 5 | 6 | -------------------------------------------------------------------------------- /src/app/test-page-b/test-page-b.component.html: -------------------------------------------------------------------------------- 1 |2 | test-page-b works! 3 |
4 | 5 | 6 | -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | // noinspection JSUnusedGlobalSymbols 2 | 3 | export const environment = { 4 | production: true, 5 | ga: 'ga4-tag-id' 6 | }; 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "tslint.autoFixOnSave": true, 3 | "editor.detectIndentation": false, 4 | "editor.tabSize": 2, 5 | "editor.codeActionsOnSave": { 6 | "source.fixAll.tslint": true 7 | } 8 | } -------------------------------------------------------------------------------- /projects/ngx-google-analytics/src/lib/types/data-layer.type.ts: -------------------------------------------------------------------------------- 1 | import {GtagFnArgs} from './gtag.type'; 2 | 3 | /** 4 | * Provides an interface on a GA command list. 5 | */ 6 | export type DataLayer = GtagFnArgs[]; 7 | -------------------------------------------------------------------------------- /projects/ngx-google-analytics/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../dist/ngx-google-analytics", 4 | "lib": { 5 | "entryFile": "src/public_api.ts" 6 | } 7 | } -------------------------------------------------------------------------------- /projects/ngx-google-analytics/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Fix the annoying problem when you try to use this library on the same environment and VSCode always used public_api path to import files. 3 | */ 4 | export * from './public_api'; 5 | 6 | -------------------------------------------------------------------------------- /projects/ngx-google-analytics/tsconfig.lib.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.lib.json", 3 | "compilerOptions": { 4 | "declarationMap": false 5 | }, 6 | "angularCompilerOptions": { 7 | "compilationMode": "partial" 8 | } 9 | } -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": ["jest"] 6 | }, 7 | "include": [ 8 | "src/**/*.spec.ts", 9 | "src/**/*.d.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "main.ts" 9 | ], 10 | "include": [ 11 | "src/**/*.d.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /projects/ngx-google-analytics/src/lib/tokens/ngx-google-analytics-window.ts: -------------------------------------------------------------------------------- 1 | import {GtagFn} from '../types/gtag.type'; 2 | import {DataLayer} from '../types/data-layer.type'; 3 | 4 | export type GaWindow = Window & { 5 | gtag?: GtagFn; 6 | dataLayer?: DataLayer; 7 | }; 8 | -------------------------------------------------------------------------------- /projects/ngx-google-analytics/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/spec", 5 | "types": ["jest"] 6 | }, 7 | "include": [ 8 | "**/*.spec.ts", 9 | "**/*.d.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /projects/ngx-google-analytics/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | transform: { 3 | '^.+\\.ts$': ['ts-jest', { 4 | diagnostics: false 5 | }] 6 | }, 7 | modulePathIgnorePatterns: [ 8 | "