Skip to content

Commit 7330b4c

Browse files
committed
Add dual id for .com and .dev.
1 parent 35993f5 commit 7330b4c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

_config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ carbon_ads:
8888

8989
google_analytics:
9090
href: https://www.google-analytics.com/analytics.js
91-
commands: [['create', 'UA-6065217-64', 'auto'], ['require', 'linkid'], ['send', 'pageview']]
91+
commands: [['create', 'UA-ACCOUNT-ID', 'auto'], ['require', 'linkid'], ['send', 'pageview']]
92+
accounts:
93+
lodash.com: 'UA-6065217-64'
94+
lodash.dev: 'UA-134340230-1'
9295

9396
exclude:
9497
- node_modules

assets/js/boot.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,14 @@
4949
}
5050
// Initialize Google Analytics.
5151
if (navigator.onLine) {
52+
var accounts = {{ site.google_analytics.accounts | jsonify }}
53+
var commands = {{ site.google_analytics.commands | jsonify }}
54+
55+
commands[0][1] = accounts[location.hostname]
56+
5257
root[root.GoogleAnalyticsObject = '_ga'] = {
5358
'l': Date.now(),
54-
'q': {{ site.google_analytics.commands | jsonify }}
59+
'q': commands
5560
}
5661
var script = document.createElement('script')
5762
script.src = '{{ site.google_analytics.href }}'

0 commit comments

Comments
 (0)