Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

swup

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

swup - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

.idea/markdown-navigator.xml

4

lib/index.js

@@ -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

3

lib/modules/loadPage.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc