https://github.com/loevgaard/dandomain-google-tag-manager
https://github.com/loevgaard/dandomain-google-tag-manager
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/loevgaard/dandomain-google-tag-manager
- Owner: loevgaard
- Created: 2015-12-02T14:52:15.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-13T14:33:20.000Z (about 10 years ago)
- Last Synced: 2025-04-07T07:48:22.511Z (12 months ago)
- Language: JavaScript
- Size: 84 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A Javascript Library for Google Tag Manager on Dandomain
Dandomain is a Danish hosting provider who also hosts one of the biggest Danish webshop systems, [Dandomain Webshop](https://www.dandomain.dk/webshop/overblik).
On Dandomain we can't manipulate server side code so we can't populate the dataLayer variable before the DOM loads.
This library makes the process of integrating the Dandomain Webshop with Google Tag Manager a bit easier.
It consists of several "modules" or methods that will eventually populate the data layer with relevant values.
## Implementation
### Product Numbers
The library presumes that you use the default Dandomain product numbering scheme which is `[number]-[variant]` where `[number]` matches the regexp `[0-9]+` and `[variant]` matches the regexp `.*`. If you use another scheme, you have to implement the method `ddgtm.parseProductNumber()`.
### Google Analytics Enhanced Ecommerce
To implement [Google Analytics Enhanced Ecommerce](https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce) features, use this code
```html
...
$(function() {
ddgtm.analyticsEcommerce();
ddgtm.populateDataLayer();
});