Skip to content

Commit 08e8ab4

Browse files
committed
📗 Updated README
1 parent ed105ce commit 08e8ab4

File tree

2 files changed

+39
-45
lines changed

2 files changed

+39
-45
lines changed

README.md

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# ngx-pixel
2-
31
![ngx-pixel header](https://storage.googleapis.com/nielskersic/static-images/github/ngx-pixel%20header-min.png)
42

5-
<center>
6-
A simple Angular library to simplify tracking using a Facebook Pixel.
7-
</center>
3+
<p align="center">
4+
An Angular library to simplify tracking using a Facebook Pixel.
5+
</p>
86

97
---
108

11-
## Introduction
9+
# Introduction
1210
Using a Facebook Pixel is fairly simple. You add the script to the `head` section of all pages, after which you can use the `fbq` function. However, in Angular it's not as straight-forward. The main two problems are as follows:
1311

1412
- Navigation using the Angular Router is not tracked.
@@ -20,13 +18,13 @@ By default, ***ngx-pixel*** is **disabled** to make it easier to comply with GDP
2018

2119
---
2220

23-
## Usage
21+
# Usage
2422
Using ***ngx-pixel*** is very simple.
2523

26-
### 1. Installing the NPM package
24+
## 1. Installing the NPM package
2725
You can install the NPM package with `npm install ngx-pixel`
2826

29-
### 2. Add it to your app module
27+
## 2. Add it to your app module
3028
Add the library to your app's module, usually `app.module.ts`. Make sure you use the `forRoot()` method. Within this method, add your [Facebook Pixel ID](https://www.facebook.com/business/help/952192354843755).
3129
```typescript
3230
import { PixelModule } from 'ngx-pixel';
@@ -46,7 +44,7 @@ export class AppModule { }
4644
```
4745
**NOTE:** By default, the library does not start tracking immediately. In most cases this requires user consent to comply with GDPR and other privacy regulations. If you would still like start tracking as soon as your app module loads, include the `enabled: true` parameter in when you call `forRoot()`.
4846

49-
### 3. Add it to your components
47+
## 3. Add it to your components
5048
In any component where you would like to track certain events, you can import the ***ngx-pixel service*** with `import { PixelService } from 'ngx-pixel';`
5149
Then you can inject the service into your component as follows:
5250
```TypeScript
@@ -59,10 +57,10 @@ export class HomeComponent {
5957
}
6058
```
6159

62-
### 4. Tracking events
60+
## 4. Tracking events
6361
There are two groups of events that you can track, namely *Standard events* and *Custom events*.
6462

65-
#### Standard events
63+
### Standard events
6664
**Standard events** are common events that Facebook has created. You can find the full list [here](https://developers.facebook.com/docs/facebook-pixel/reference). You can track a Standard event like this:
6765
![Track Standard events using ngx-pixel](https://storage.googleapis.com/nielskersic/static-images/github/ngx-pixel-track-large.gif)
6866

@@ -75,7 +73,7 @@ this.pixel.track('InitiateCheckout', {
7573
});
7674
```
7775

78-
#### Custom events
76+
### Custom events
7977
Tracking **Custom events** works very similar to tracking Standard events. The only major difference is that there are no TypeScript interfaces and therefore no Intellisense. This is because the event *name* and optional *properties* can be anything. Tracking a custom event with ***ngx-pixel*** looks like this:
8078
```TypeScript
8179
this.pixel.trackCustom('MyCustomEvent');
@@ -90,10 +88,10 @@ this.pixel.trackCustom('MyCustomEvent', {
9088

9189
---
9290

93-
## Enabling and disabling ***ngx-pixel*** <a name="enabling"></a>
91+
# Enabling and disabling ***ngx-pixel*** <a name="enabling"></a>
9492
***ngx-pixel*** is disabled by default. In many cases, tracking without user consent is not allowed by privacy regulations like the European GDPR. ***ngx-pixel*** also doesn't inject the Facebook scripts until it is iniaitlized (upon consent), which helps cut down the initial loading size and time of your application.
9593

96-
### Enabling ***ngx-pixel*** immediately
94+
## Enabling ***ngx-pixel*** immediately
9795
It is still possible to initialize ***ngx-pixel*** as soon as your app module loads.
9896
When adding ***ngx-pixel*** to `app.module.ts`, add the parameter `enabled: true`.
9997
```TypeScript
@@ -103,7 +101,7 @@ imports: [
103101
],
104102
```
105103

106-
### Enabling ***ngx-pixel*** from a component
104+
## Enabling ***ngx-pixel*** from a component
107105
You can also enable ***ngx-pixel*** from within any of your components, like so:
108106
```TypeScript
109107
export class HomeComponent {
@@ -119,7 +117,7 @@ export class HomeComponent {
119117
}
120118
```
121119

122-
### Disabling ***ngx-pixel***
120+
## Disabling ***ngx-pixel***
123121
Disabling works very similar to *enabling* from within a component and looks like this:
124122
```TypeScript
125123
export class HomeComponent {
@@ -137,21 +135,21 @@ export class HomeComponent {
137135

138136
---
139137

140-
## Important notes
141-
- Backwards compatibility is not guaranteed. ***ngx-pixel*** was developed using Angular 11, which uses the Ivy compiler instead of the older View Engine compiler. If your project uses Angular 8 or earlier, or if you decided to keep using View Engine with newer Angular versions, ***ngx-pixel*** might not be compatible, although I have not yet tested this to confirm.
138+
# Important notes
139+
- Backwards compatibility is not guaranteed. ***ngx-pixel*** was developed using Angular 11, which uses the Ivy compiler instead of the older View Engine compiler. If your project uses Angular 8 or earlier, or if you've decided to keep using View Engine with newer Angular versions, ***ngx-pixel*** might not be compatible, although I have not yet tested this to confirm.
142140

143141
---
144142

145-
## What's next?
143+
# What's next?
146144
- [ ] Checking Pixel ID's using a RegEx. First need to confirm whether all Pixel ID's follow the same format.
147145
- [ ] Adding tests.
148146
- [ ] Testing View Engine backwards-compatibility.
149147
- [ ] Removing all Facebook scripts on removal, not just the initial script.
150148

151149
---
152-
<center>
153-
Created with ❤️ by Niels Kersic, [niels.codes](https://niels.codes).
154-
</center>
150+
151+
Created with ❤️ by Niels Kersic, [niels.codes](https://google.com).
152+
155153

156154

157155

projects/pixel/README.md

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# ngx-pixel
2-
31
![ngx-pixel header](https://storage.googleapis.com/nielskersic/static-images/github/ngx-pixel%20header-min.png)
42

5-
<center>
6-
A simple Angular library to simplify tracking using a Facebook Pixel.
7-
</center>
3+
<p align="center">
4+
An Angular library to simplify tracking using a Facebook Pixel.
5+
</p>
86

97
---
108

11-
## Introduction
9+
# Introduction
1210
Using a Facebook Pixel is fairly simple. You add the script to the `head` section of all pages, after which you can use the `fbq` function. However, in Angular it's not as straight-forward. The main two problems are as follows:
1311

1412
- Navigation using the Angular Router is not tracked.
@@ -20,13 +18,13 @@ By default, ***ngx-pixel*** is **disabled** to make it easier to comply with GDP
2018

2119
---
2220

23-
## Usage
21+
# Usage
2422
Using ***ngx-pixel*** is very simple.
2523

26-
### 1. Installing the NPM package
24+
## 1. Installing the NPM package
2725
You can install the NPM package with `npm install ngx-pixel`
2826

29-
### 2. Add it to your app module
27+
## 2. Add it to your app module
3028
Add the library to your app's module, usually `app.module.ts`. Make sure you use the `forRoot()` method. Within this method, add your [Facebook Pixel ID](https://www.facebook.com/business/help/952192354843755).
3129
```typescript
3230
import { PixelModule } from 'ngx-pixel';
@@ -46,7 +44,7 @@ export class AppModule { }
4644
```
4745
**NOTE:** By default, the library does not start tracking immediately. In most cases this requires user consent to comply with GDPR and other privacy regulations. If you would still like start tracking as soon as your app module loads, include the `enabled: true` parameter in when you call `forRoot()`.
4846

49-
### 3. Add it to your components
47+
## 3. Add it to your components
5048
In any component where you would like to track certain events, you can import the ***ngx-pixel service*** with `import { PixelService } from 'ngx-pixel';`
5149
Then you can inject the service into your component as follows:
5250
```TypeScript
@@ -59,10 +57,10 @@ export class HomeComponent {
5957
}
6058
```
6159

62-
### 4. Tracking events
60+
## 4. Tracking events
6361
There are two groups of events that you can track, namely *Standard events* and *Custom events*.
6462

65-
#### Standard events
63+
### Standard events
6664
**Standard events** are common events that Facebook has created. You can find the full list [here](https://developers.facebook.com/docs/facebook-pixel/reference). You can track a Standard event like this:
6765
![Track Standard events using ngx-pixel](https://storage.googleapis.com/nielskersic/static-images/github/ngx-pixel-track-large.gif)
6866

@@ -75,7 +73,7 @@ this.pixel.track('InitiateCheckout', {
7573
});
7674
```
7775

78-
#### Custom events
76+
### Custom events
7977
Tracking **Custom events** works very similar to tracking Standard events. The only major difference is that there are no TypeScript interfaces and therefore no Intellisense. This is because the event *name* and optional *properties* can be anything. Tracking a custom event with ***ngx-pixel*** looks like this:
8078
```TypeScript
8179
this.pixel.trackCustom('MyCustomEvent');
@@ -90,10 +88,10 @@ this.pixel.trackCustom('MyCustomEvent', {
9088

9189
---
9290

93-
## Enabling and disabling ***ngx-pixel*** <a name="enabling"></a>
91+
# Enabling and disabling ***ngx-pixel*** <a name="enabling"></a>
9492
***ngx-pixel*** is disabled by default. In many cases, tracking without user consent is not allowed by privacy regulations like the European GDPR. ***ngx-pixel*** also doesn't inject the Facebook scripts until it is iniaitlized (upon consent), which helps cut down the initial loading size and time of your application.
9593

96-
### Enabling ***ngx-pixel*** immediately
94+
## Enabling ***ngx-pixel*** immediately
9795
It is still possible to initialize ***ngx-pixel*** as soon as your app module loads.
9896
When adding ***ngx-pixel*** to `app.module.ts`, add the parameter `enabled: true`.
9997
```TypeScript
@@ -103,7 +101,7 @@ imports: [
103101
],
104102
```
105103

106-
### Enabling ***ngx-pixel*** from a component
104+
## Enabling ***ngx-pixel*** from a component
107105
You can also enable ***ngx-pixel*** from within any of your components, like so:
108106
```TypeScript
109107
export class HomeComponent {
@@ -119,7 +117,7 @@ export class HomeComponent {
119117
}
120118
```
121119

122-
### Disabling ***ngx-pixel***
120+
## Disabling ***ngx-pixel***
123121
Disabling works very similar to *enabling* from within a component and looks like this:
124122
```TypeScript
125123
export class HomeComponent {
@@ -137,21 +135,19 @@ export class HomeComponent {
137135

138136
---
139137

140-
## Important notes
141-
- Backwards compatibility is not guaranteed. ***ngx-pixel*** was developed using Angular 11, which uses the Ivy compiler instead of the older View Engine compiler. If your project uses Angular 8 or earlier, or if you decided to keep using View Engine with newer Angular versions, ***ngx-pixel*** might not be compatible, although I have not yet tested this to confirm.
138+
# Important notes
139+
- Backwards compatibility is not guaranteed. ***ngx-pixel*** was developed using Angular 11, which uses the Ivy compiler instead of the older View Engine compiler. If your project uses Angular 8 or earlier, or if you've decided to keep using View Engine with newer Angular versions, ***ngx-pixel*** might not be compatible, although I have not yet tested this to confirm.
142140

143141
---
144142

145-
## What's next?
143+
# What's next?
146144
- [ ] Checking Pixel ID's using a RegEx. First need to confirm whether all Pixel ID's follow the same format.
147145
- [ ] Adding tests.
148146
- [ ] Testing View Engine backwards-compatibility.
149147
- [ ] Removing all Facebook scripts on removal, not just the initial script.
150148

151149
---
152-
<center>
153150
Created with ❤️ by Niels Kersic, [niels.codes](https://niels.codes).
154-
</center>
155151

156152

157153

0 commit comments

Comments
 (0)