# ember-cli-reddit-pixel

> Reddit Pixel functionality for ember apps.

Latest version **0.0.2** (published 2020-10-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-cli-reddit-pixel
pnpm add ember-cli-reddit-pixel
yarn add ember-cli-reddit-pixel
bun add ember-cli-reddit-pixel
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2020-10-19 |
| First published | 2020-10-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^4.5 \|\| 6.* \|\| >= 7.* |
| Dependencies | 1 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Leo Camangian Jr |
| Maintainers | zanpaktu |
| Keywords | ember-addon, reddit, pixel, reddit-pixel |

## Links

- npm: https://www.npmjs.com/package/ember-cli-reddit-pixel
- Repository: https://github.com/zanpaktu/ember-cli-reddit-pixel
- Homepage: https://github.com/zanpaktu/ember-cli-reddit-pixel#readme
- Issues: https://github.com/zanpaktu/ember-cli-reddit-pixel/issues
- npm.io page: https://npm.io/package/ember-cli-reddit-pixel

## Dependencies (1)

- [ember-cli-babel](https://npm.io/package/ember-cli-babel.md) ^6.6.0

## Recent versions

- 0.0.2 (latest) — 2020-10-19
- 0.0.1 — 2020-10-19

## README

ember-cli-reddit-pixel
==============================================================================

Plugin for ember-cli that injects Reddit Pixel tracking code into HTML <head> content. 

Installation
------------------------------------------------------------------------------

```
ember install ember-cli-reddi-pixel
```


Usage
------------------------------------------------------------------------------

Once your environment is configred to include your Pixel id (and the enabled flag is set to true), the Reddit 
 Pixel tracking code will be injected into your index.html file.
 
A service is provided for simple access to the global `rdt(...)` function inside of your Ember application.
 This service allows you to call the global `rdt(...)` function regardless of your environment - if the 
 Reddit Pixel code hasn't been injected in your head (consequently, the `rdt(...)` function 
 is not available), the service will disregard the function call. 
 
 ```js
// environment.js
 
var ENV = {
	redditPixel: {
    	enabled: false,
	id: 'xxxxxxxxxxxxxxx',

    }
};
 
if (environment === 'production') {
	ENV.redditPixel.enabled = true;
}
 ```
 
```javascript
import { inject } from '@ember/service';

export default Ember.Component.extend({
	redditPixel: inject(),
	
	actions: {
		buttonClicked() {
			this.get('redditPixel').rdt('track', 'SomeEventName');
		}
	}
});

```

In the above example, the global `rdt(...)` function will be called in  the production environment, sending 
 `rdt('track', 'SomeEventName')`. If in the development environment, `rdt('track', 'SomeEventName')` will be
 discarded; only a console.log statement (with the rtd parameters) will be called.

---
_Source: https://npm.io/package/ember-cli-reddit-pixel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
