Skip to content

Commit

Permalink
refactor: enforce tid and cid args;
Browse files Browse the repository at this point in the history
- rename `opts` —> `args`
- reuse `args` for 2 bytes saving lol
  • Loading branch information
lukeed committed Oct 17, 2018
1 parent ac99986 commit 3f541f2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
var KEY = 'ga:user';

export default function (ua, opts, toWait) {
opts = opts || {};
var args = Object.assign({ tid:ua, cid:UID }, opts);
export default function (ua, args, toWait) {
args = args || {};
var cid = (localStorage[KEY] = localStorage[KEY] || Math.random() + '.' + Math.random());
Object.assign(args, { tid:ua, cid });

function send(type, opts) {
if (type === 'pageview' && !opts) {
Expand Down

0 comments on commit 3f541f2

Please sign in to comment.