From 659285a623797356b4ff4af2acaaa1aa61ce293e Mon Sep 17 00:00:00 2001 From: Stuart Date: Wed, 20 Mar 2019 10:31:07 -0400 Subject: [PATCH] 1.0.5, add tz timezone also switches to implicit return arrow functions --- README.md | 6 ++++-- dist/openpixel.js | 6 +++++- dist/openpixel.min.js | 4 ++-- gulpfile.js | 2 +- package-lock.json | 6 +++--- package.json | 2 +- src/pixel.js | 44 +++++++++++++++++++++---------------------- 7 files changed, 38 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 8be1f05..17f9207 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,13 @@ There are 2 automatic events, the `pageload` event which is sent as the main eve 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. ``` -opix("event","reservation requested") +opix('event', 'reservation_requested') ``` You can also pass a string or json as the third parameter to send other data with the event. ``` -opix("event","reservation requested", {someData: 1, otherData: "cool"}) +opix('event', 'reservation_requested', {someData: 1, otherData: 'cool'}) +opix('event', 'reservation_requested', {someData: 1, otherData: 'cool'}) ``` ## Setup and Customize @@ -85,6 +86,7 @@ https://tracker.example.com/pixel.gif?id=R29X8&uid=1-ovbam3yz-iolwx617&ev=pagelo | bn | Chrome 50 | browser name | | md | false | mobile device | | ua | _full user agent_ | user agent | +| tz | 240 | timezone offset (minutes away from utc) | | utm_source | | Campaign Source | | utm_medium | | Campaign Medium | | utm_term | | Campaign Term | diff --git a/dist/openpixel.js b/dist/openpixel.js index ad7176c..5eac9d1 100644 --- a/dist/openpixel.js +++ b/dist/openpixel.js @@ -1,4 +1,4 @@ -// Open Pixel v1.0.2 | Published By Dockwa | Created By Stuart Yamartino | MIT License +// Open Pixel v1.0.5 | Published By Dockwa | Created By Stuart Yamartino | MIT License ;(function(window, document, pixelFunc, pixelFuncName, pixelEndpoint, versionNumber) { "use strict"; @@ -262,6 +262,10 @@ function () { return Browser.userAgent(); }, // user agent + tz: function tz() { + return new Date().getTimezoneOffset(); + }, + // timezone utm_source: function utm_source(key) { return Cookie.getUtm(key); }, diff --git a/dist/openpixel.min.js b/dist/openpixel.min.js index 9ae5251..5a45972 100644 --- a/dist/openpixel.min.js +++ b/dist/openpixel.min.js @@ -1,2 +1,2 @@ -// Open Pixel v1.0.2 | Published By Dockwa | Created By Stuart Yamartino | MIT License -!function(i,u,r,t,e,n){"use strict";function o(t,e){for(var n=0;n{return Config.id}, // website Id - uid: ()=>{return Cookie.get('uid')}, // user Id - ev: ()=>{return this.event}, // event being triggered - ed: ()=>{return this.optinal}, // any event data to pass along - v: ()=>{return Config.version}, // openpixel.js version - dl: ()=>{return window.location.href}, // document location - rl: ()=>{return document.referrer}, // referrer location - ts: ()=>{return this.timestamp}, // timestamp when event was triggered - de: ()=>{return document.characterSet}, // document encoding - sr: ()=>{return window.screen.width + 'x' + window.screen.height}, // screen resolution - vp: ()=>{return window.innerWidth + 'x' + window.innerHeight}, // viewport size - cd: ()=>{return window.screen.colorDepth}, // color depth - dt: ()=>{return document.title}, // document title - bn: ()=>{return Browser.nameAndVersion()}, // browser name and version number - md: ()=>{return Browser.isMobile()}, // is a mobile device? - ua: ()=>{return Browser.userAgent()}, // user agent - tz: ()=>{return (new Date()).getTimezoneOffset()}, // timezone - utm_source: (key)=>{return Cookie.getUtm(key)}, // get the utm source - utm_medium: (key)=>{return Cookie.getUtm(key)}, // get the utm medium - utm_term: (key)=>{return Cookie.getUtm(key)}, // get the utm term - utm_content: (key)=>{return Cookie.getUtm(key)}, // get the utm concent - utm_campaign: (key)=>{return Cookie.getUtm(key)}, // get the utm campaign + id: () => Config.id, // website Id + uid: () => Cookie.get('uid'), // user Id + ev: () => this.event, // event being triggered + ed: () => this.optinal, // any event data to pass along + v: () => Config.version, // openpixel.js version + dl: () => window.location.href, // document location + rl: () => document.referrer, // referrer location + ts: () => this.timestamp, // timestamp when event was triggered + de: () => document.characterSet, // document encoding + sr: () => window.screen.width + 'x' + window.screen.height, // screen resolution + vp: () => window.innerWidth + 'x' + window.innerHeight, // viewport size + cd: () => window.screen.colorDepth, // color depth + dt: () => document.title, // document title + bn: () => Browser.nameAndVersion(), // browser name and version number + md: () => Browser.isMobile(), // is a mobile device? + ua: () => Browser.userAgent(), // user agent + tz: () => (new Date()).getTimezoneOffset(), // timezone + utm_source: key => Cookie.getUtm(key), // get the utm source + utm_medium: key => Cookie.getUtm(key), // get the utm medium + utm_term: key => Cookie.getUtm(key), // get the utm term + utm_content: key => Cookie.getUtm(key), // get the utm concent + utm_campaign: key => Cookie.getUtm(key), // get the utm campaign } }