Comparing version 0.4.1 to 0.4.2
@@ -414,2 +414,6 @@ 'use strict'; | ||
if (link.getHash() != '') { | ||
this.scrollToElement = link.getHash(); | ||
} | ||
if (form.method.toLowerCase() != "get") { | ||
@@ -416,0 +420,0 @@ // remove page from cache |
@@ -85,5 +85,2 @@ 'use strict'; | ||
finalPage = _this.cache.getPage(data.url); | ||
if (!_this.options.cache) { | ||
_this.cache.empty(_this.options.debugMode); | ||
} | ||
_this.renderPage(finalPage, popstate); | ||
@@ -90,0 +87,0 @@ _this.preloadPromise = null; |
@@ -28,2 +28,5 @@ 'use strict'; | ||
this.triggerEvent('pageView'); | ||
if (!this.options.cache) { | ||
this.cache.empty(this.options.debugMode); | ||
} | ||
setTimeout(function () { | ||
@@ -30,0 +33,0 @@ document.documentElement.classList.remove('is-animating'); |
{ | ||
"name": "swup", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Animated page transitions with css.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -38,2 +38,4 @@ # swup | ||
* [swupMergeHeadPlugin](#swupmergeheadplugin) | ||
* [swupGaPlugin](#swupgaplugin) | ||
* [swupGtmPlugin](#swupgtmplugin) | ||
@@ -400,2 +402,28 @@ [API](#api) | ||
### swupGaPlugin | ||
Google Analytics Plugin triggers `pageview` event on `swup:contentReplaced` (on each page change). | ||
Note that this event is not triggered at the first load, so the first page view must be triggered elsewhere. | ||
However, page view event is by default triggered in [Javascripts tracking snippet](https://developers.google.com/analytics/devguides/collection/analyticsjs/#the_javascript_tracking_snippet). | ||
Simplified code run by this plugin on `swup:contentReplaced`: | ||
```javascript | ||
window.ga('set', 'title', document.title); | ||
window.ga('set', 'page', window.location.pathname + window.location.search); | ||
window.ga('send', 'pageview'); | ||
``` | ||
### swupGtmPlugin | ||
Google Tag Manager Plugin triggers `VirtualPageview` event on `swup:contentReplaced` (on each page change) which can be associated with a page view within GTM. | ||
Event object also includes `virtualPageURL` holding the url of the page and `virtualPageTitle` holding the title of the page. | ||
Note that this event is not triggered at the first load, so the first page view must be triggered elsewhere. | ||
Simplified code run by this plugin on `swup:contentReplaced`: | ||
```javascript | ||
window.dataLayer.push({ | ||
'event': 'VirtualPageview', | ||
'virtualPageURL': window.location.pathname + window.location.search, | ||
'virtualPageTitle': document.title | ||
}); | ||
``` | ||
## API | ||
@@ -402,0 +430,0 @@ The instance of the swup can be imported and used across your sites JavaScript to enable some additional features. When debug mode (see [options](#options) section) is enabled, instance is also available in `window` object as `window.swup`. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38
1108
474
132473