|
8 | 8 | * modification, are permitted provided that the following conditions are |
9 | 9 | * met: |
10 | 10 | * |
11 | | - * * Redistributions of source code must retain the above copyright |
12 | | - * notice, this list of conditions and the following disclaimer. |
| 11 | + * * Redistributions of source code must retain the above copyright |
| 12 | + * notice, this list of conditions and the following disclaimer. |
13 | 13 | * |
14 | | - * * Redistributions in binary form must reproduce the above copyright |
15 | | - * notice, this list of conditions and the following disclaimer in the |
16 | | - * documentation and/or other materials provided with the distribution. |
| 14 | + * * Redistributions in binary form must reproduce the above copyright |
| 15 | + * notice, this list of conditions and the following disclaimer in the |
| 16 | + * documentation and/or other materials provided with the distribution. |
17 | 17 | * |
18 | 18 | * * Neither the name of Anthon Pang nor Snowplow Analytics Ltd nor the |
19 | 19 | * names of their contributors may be used to endorse or promote products |
20 | | - * derived from this software without specific prior written permission. |
| 20 | + * derived from this software without specific prior written permission. |
21 | 21 | * |
22 | | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
23 | | - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
24 | | - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
25 | | - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
26 | | - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
27 | | - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
28 | | - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
29 | | - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
30 | | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
31 | | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 22 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 23 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 24 | + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 25 | + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 26 | + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 27 | + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 28 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 29 | + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 30 | + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 31 | + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
32 | 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | 33 | */ |
34 | 34 |
|
|
80 | 80 | * 18. crossDomainLinker, false |
81 | 81 | * 19. maxPostBytes, 40000 |
82 | 82 | * 20. discoverRootDomain, false |
| 83 | + * 21. cookieLifetime, 63072000 |
83 | 84 | */ |
84 | 85 | object.Tracker = function Tracker(functionName, namespace, version, mutSnowplowState, argmap) { |
85 | 86 |
|
|
162 | 163 | configCountPreRendered, |
163 | 164 |
|
164 | 165 | // Life of the visitor cookie (in seconds) |
165 | | - configVisitorCookieTimeout = 63072000, // 2 years |
| 166 | + configVisitorCookieTimeout = argmap.hasOwnProperty('cookieLifetime') ? argmap.cookieLifetime : 63072000, // 2 years |
166 | 167 |
|
167 | 168 | // Life of the session cookie (in seconds) |
168 | 169 | configSessionCookieTimeout = argmap.hasOwnProperty('sessionCookieTimeout') ? argmap.sessionCookieTimeout : 1800, // 30 minutes |
|
484 | 485 | */ |
485 | 486 | function resetMaxScrolls() { |
486 | 487 | var offsets = getPageOffsets(); |
487 | | - |
| 488 | + |
488 | 489 | var x = offsets[0]; |
489 | 490 | minXOffset = x; |
490 | 491 | maxXOffset = x; |
491 | | - |
| 492 | + |
492 | 493 | var y = offsets[1]; |
493 | 494 | minYOffset = y; |
494 | 495 | maxYOffset = y; |
|
499 | 500 | */ |
500 | 501 | function updateMaxScrolls() { |
501 | 502 | var offsets = getPageOffsets(); |
502 | | - |
| 503 | + |
503 | 504 | var x = offsets[0]; |
504 | 505 | if (x < minXOffset) { |
505 | 506 | minXOffset = x; |
|
512 | 513 | minYOffset = y; |
513 | 514 | } else if (y > maxYOffset) { |
514 | 515 | maxYOffset = y; |
515 | | - } |
| 516 | + } |
516 | 517 | } |
517 | 518 |
|
518 | 519 | /* |
|
1310 | 1311 | * @param string total |
1311 | 1312 | * @param string tax |
1312 | 1313 | * @param string shipping |
1313 | | - * @param string city |
| 1314 | + * @param string city |
1314 | 1315 | * @param string state |
1315 | 1316 | * @param string country |
1316 | 1317 | * @param string currency The currency the total/tax/shipping are expressed in |
|
1343 | 1344 | * E.g: (moz, hidden) -> mozHidden |
1344 | 1345 | */ |
1345 | 1346 | function prefixPropertyName(prefix, propertyName) { |
1346 | | - |
| 1347 | + |
1347 | 1348 | if (prefix !== '') { |
1348 | 1349 | return prefix + propertyName.charAt(0).toUpperCase() + propertyName.slice(1); |
1349 | 1350 | } |
|
1576 | 1577 | * where tracking is: |
1577 | 1578 | * 1) Sending events to a collector |
1578 | 1579 | * 2) Setting first-party cookies |
1579 | | - * @param bool enable If true and Do Not Track feature enabled, don't track. |
| 1580 | + * @param bool enable If true and Do Not Track feature enabled, don't track. |
1580 | 1581 | */ |
1581 | 1582 | respectDoNotTrack: function (enable) { |
1582 | 1583 | helpers.warn('This usage of respectDoNotTrack is deprecated. Instead add a "respectDoNotTrack" field to the argmap argument of newTracker.'); |
|
1619 | 1620 | * be "_self", "_top", or "_parent"). |
1620 | 1621 | * |
1621 | 1622 | * @see https://bugs.webkit.org/show_bug.cgi?id=54783 |
1622 | | - * |
| 1623 | + * |
1623 | 1624 | * @param object criterion Criterion by which it will be decided whether a link will be tracked |
1624 | 1625 | * @param bool pseudoClicks If true, use pseudo click-handler (mousedown+mouseup) |
1625 | 1626 | * @param bool trackContent Whether to track the innerHTML of the link element |
|
1726 | 1727 |
|
1727 | 1728 | /** |
1728 | 1729 | * Set the business-defined user ID for this user using the location querystring. |
1729 | | - * |
| 1730 | + * |
1730 | 1731 | * @param string queryName Name of a querystring name-value pair |
1731 | 1732 | */ |
1732 | 1733 | setUserIdFromLocation: function(querystringField) { |
|
1736 | 1737 |
|
1737 | 1738 | /** |
1738 | 1739 | * Set the business-defined user ID for this user using the referrer querystring. |
1739 | | - * |
| 1740 | + * |
1740 | 1741 | * @param string queryName Name of a querystring name-value pair |
1741 | 1742 | */ |
1742 | 1743 | setUserIdFromReferrer: function(querystringField) { |
|
1746 | 1747 |
|
1747 | 1748 | /** |
1748 | 1749 | * Set the business-defined user ID for this user to the value of a cookie. |
1749 | | - * |
| 1750 | + * |
1750 | 1751 | * @param string cookieName Name of the cookie whose value will be assigned to businessUserId |
1751 | 1752 | */ |
1752 | 1753 | setUserIdFromCookie: function(cookieName) { |
1753 | 1754 | businessUserId = cookie.cookie(cookieName); |
1754 | 1755 | }, |
1755 | 1756 |
|
1756 | 1757 | /** |
1757 | | - * Configure this tracker to log to a CloudFront collector. |
| 1758 | + * Configure this tracker to log to a CloudFront collector. |
1758 | 1759 | * |
1759 | 1760 | * @param string distSubdomain The subdomain on your CloudFront collector's distribution |
1760 | 1761 | */ |
|
1766 | 1767 | * |
1767 | 1768 | * Specify the Snowplow collector URL. No need to include HTTP |
1768 | 1769 | * or HTTPS - we will add this. |
1769 | | - * |
| 1770 | + * |
1770 | 1771 | * @param string rawUrl The collector URL minus protocol and /i |
1771 | 1772 | */ |
1772 | 1773 | setCollectorUrl: function (rawUrl) { |
|
1976 | 1977 | * Track an ad being served |
1977 | 1978 | * |
1978 | 1979 | * @param string impressionId Identifier for a particular ad impression |
1979 | | - * @param string costModel The cost model. 'cpa', 'cpc', or 'cpm' |
| 1980 | + * @param string costModel The cost model. 'cpa', 'cpc', or 'cpm' |
1980 | 1981 | * @param number cost Cost |
1981 | 1982 | * @param string bannerId Identifier for the ad banner displayed |
1982 | 1983 | * @param string zoneId Identifier for the ad zone |
|
1990 | 1991 | core.trackAdImpression(impressionId, costModel, cost, targetUrl, bannerId, zoneId, advertiserId, campaignId, addCommonContexts(context), tstamp); |
1991 | 1992 | }); |
1992 | 1993 | }, |
1993 | | - |
| 1994 | + |
1994 | 1995 | /** |
1995 | 1996 | * Track an ad being clicked |
1996 | 1997 | * |
1997 | 1998 | * @param string clickId Identifier for the ad click |
1998 | | - * @param string costModel The cost model. 'cpa', 'cpc', or 'cpm' |
| 1999 | + * @param string costModel The cost model. 'cpa', 'cpc', or 'cpm' |
1999 | 2000 | * @param number cost Cost |
2000 | 2001 | * @param string targetUrl (required) The link's target URL |
2001 | 2002 | * @param string bannerId Identifier for the ad banner displayed |
|
0 commit comments