Skip to content

Commit 659285a

Browse files
committed
1.0.5, add tz timezone
also switches to implicit return arrow functions
1 parent 70da9c1 commit 659285a

File tree

7 files changed

+38
-32
lines changed

7 files changed

+38
-32
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ There are 2 automatic events, the `pageload` event which is sent as the main eve
2727
Openpixel is flexible with events though, you can make calls to any events with any data you want to be sent with the beacon. Whenever an event is called, it sends a beacon just like the other beacons that have a timestamp and everything else. Here is an example of a custom event being called. Note: In this case we are using the `opix` function name but this will be custom based on your build of openpixel.
2828

2929
```
30-
opix("event","reservation requested")
30+
opix('event', 'reservation_requested')
3131
```
3232
You can also pass a string or json as the third parameter to send other data with the event.
3333

3434
```
35-
opix("event","reservation requested", {someData: 1, otherData: "cool"})
35+
opix('event', 'reservation_requested', {someData: 1, otherData: 'cool'})
36+
opix('event', 'reservation_requested', {someData: 1, otherData: 'cool'})
3637
```
3738

3839
## Setup and Customize
@@ -85,6 +86,7 @@ https://tracker.example.com/pixel.gif?id=R29X8&uid=1-ovbam3yz-iolwx617&ev=pagelo
8586
| bn | Chrome 50 | browser name |
8687
| md | false | mobile device |
8788
| ua | _full user agent_ | user agent |
89+
| tz | 240 | timezone offset (minutes away from utc) |
8890
| utm_source | | Campaign Source |
8991
| utm_medium | | Campaign Medium |
9092
| utm_term | | Campaign Term |

dist/openpixel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Open Pixel v1.0.2 | Published By Dockwa | Created By Stuart Yamartino | MIT License
1+
// Open Pixel v1.0.5 | Published By Dockwa | Created By Stuart Yamartino | MIT License
22
;(function(window, document, pixelFunc, pixelFuncName, pixelEndpoint, versionNumber) {
33
"use strict";
44

@@ -262,6 +262,10 @@ function () {
262262
return Browser.userAgent();
263263
},
264264
// user agent
265+
tz: function tz() {
266+
return new Date().getTimezoneOffset();
267+
},
268+
// timezone
265269
utm_source: function utm_source(key) {
266270
return Cookie.getUtm(key);
267271
},

dist/openpixel.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ---------- Configurations for your custom build of open pixel ---------- //
22

33
// This is the header comment that will be included at the top of the "dist/openpixel.js" file
4-
var HEADER_COMMENT = process.env.OPIX_HEADER_COMMENT || '// Open Pixel v1.0.2 | Published By Dockwa | Created By Stuart Yamartino | MIT License\n';
4+
var HEADER_COMMENT = process.env.OPIX_HEADER_COMMENT || '// Open Pixel v1.0.5 | Published By Dockwa | Created By Stuart Yamartino | MIT License\n';
55

66
// This is where the compiled snippet and openpixel.js files will be dropped
77
var DESTINATION_FOLDER = process.env.OPIX_DESTINATION_FOLDER || './dist';

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "openpixel",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "Open Pixel is a JavaScript library for creating embeddable and intelligent tracking pixels",
55
"main": "openpixel.min.js",
66
"dependencies": {

src/pixel.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,28 @@ class Pixel {
1919

2020
getAttribute() {
2121
return {
22-
id: ()=>{return Config.id}, // website Id
23-
uid: ()=>{return Cookie.get('uid')}, // user Id
24-
ev: ()=>{return this.event}, // event being triggered
25-
ed: ()=>{return this.optinal}, // any event data to pass along
26-
v: ()=>{return Config.version}, // openpixel.js version
27-
dl: ()=>{return window.location.href}, // document location
28-
rl: ()=>{return document.referrer}, // referrer location
29-
ts: ()=>{return this.timestamp}, // timestamp when event was triggered
30-
de: ()=>{return document.characterSet}, // document encoding
31-
sr: ()=>{return window.screen.width + 'x' + window.screen.height}, // screen resolution
32-
vp: ()=>{return window.innerWidth + 'x' + window.innerHeight}, // viewport size
33-
cd: ()=>{return window.screen.colorDepth}, // color depth
34-
dt: ()=>{return document.title}, // document title
35-
bn: ()=>{return Browser.nameAndVersion()}, // browser name and version number
36-
md: ()=>{return Browser.isMobile()}, // is a mobile device?
37-
ua: ()=>{return Browser.userAgent()}, // user agent
38-
tz: ()=>{return (new Date()).getTimezoneOffset()}, // timezone
39-
utm_source: (key)=>{return Cookie.getUtm(key)}, // get the utm source
40-
utm_medium: (key)=>{return Cookie.getUtm(key)}, // get the utm medium
41-
utm_term: (key)=>{return Cookie.getUtm(key)}, // get the utm term
42-
utm_content: (key)=>{return Cookie.getUtm(key)}, // get the utm concent
43-
utm_campaign: (key)=>{return Cookie.getUtm(key)}, // get the utm campaign
22+
id: () => Config.id, // website Id
23+
uid: () => Cookie.get('uid'), // user Id
24+
ev: () => this.event, // event being triggered
25+
ed: () => this.optinal, // any event data to pass along
26+
v: () => Config.version, // openpixel.js version
27+
dl: () => window.location.href, // document location
28+
rl: () => document.referrer, // referrer location
29+
ts: () => this.timestamp, // timestamp when event was triggered
30+
de: () => document.characterSet, // document encoding
31+
sr: () => window.screen.width + 'x' + window.screen.height, // screen resolution
32+
vp: () => window.innerWidth + 'x' + window.innerHeight, // viewport size
33+
cd: () => window.screen.colorDepth, // color depth
34+
dt: () => document.title, // document title
35+
bn: () => Browser.nameAndVersion(), // browser name and version number
36+
md: () => Browser.isMobile(), // is a mobile device?
37+
ua: () => Browser.userAgent(), // user agent
38+
tz: () => (new Date()).getTimezoneOffset(), // timezone
39+
utm_source: key => Cookie.getUtm(key), // get the utm source
40+
utm_medium: key => Cookie.getUtm(key), // get the utm medium
41+
utm_term: key => Cookie.getUtm(key), // get the utm term
42+
utm_content: key => Cookie.getUtm(key), // get the utm concent
43+
utm_campaign: key => Cookie.getUtm(key), // get the utm campaign
4444
}
4545
}
4646

0 commit comments

Comments
 (0)