Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtag fix #151

Merged
merged 4 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149346,7 +149346,7 @@ function setCookie(name2, value, exdays = 7) {
window.dataLayer = window["dataLayer"] || [];
function gtag() {
const dataLayer = window.dataLayer;
dataLayer.push();
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "UA-210924287-3");
Expand Down Expand Up @@ -152050,7 +152050,7 @@ var import_react19 = __toESM(require_react());

// package.json
var name = "buildrs";
var version = "1.0.0-r264";
var version = "1.0.0-r257";
var main = "src/index.jsx";
var homepage = "https://github.com/buildrs/Share";
var bugs = {
Expand Down
4 changes: 2 additions & 2 deletions docs/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "buildrs",
"version": "1.0.0-r264",
"version": "1.0.0-r257",
"main": "src/index.jsx",
"homepage": "https://github.com/buildrs/Share",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/gtag.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function gtag() {
const dataLayer = window.dataLayer
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments

dataLayer.push()
dataLayer.push(arguments)
}
gtag('js', new Date())
gtag('config', 'UA-210924287-3')
12 changes: 12 additions & 0 deletions src/utils/gtag.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import gtag from './gtag'

test('gtag', () => {
let args = null
window.dataLayer = {
push: (a) => {
args = a
},
}
gtag('a', 'b')
expect(args).toMatchObject({0: 'a', 1: 'b'})
})