File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -789,7 +789,10 @@ var _sendParamsReferrerUserProperties = function _sendParamsReferrerUserProperti
789
789
* @private
790
790
*/
791
791
AmplitudeClient . prototype . _getReferrer = function _getReferrer ( ) {
792
- return typeof document !== 'undefined' ? document . referrer : '' ;
792
+ const urlRefer = this . _getReferrerFromUrlParam ( this . _getUrlParams ( ) ) ;
793
+
794
+ if ( urlRefer ) return urlRefer ;
795
+ else typeof document !== 'undefined' ? document . referrer : '' ;
793
796
} ;
794
797
795
798
/**
@@ -835,6 +838,14 @@ AmplitudeClient.prototype._getDeviceIdFromUrlParam = function _getDeviceIdFromUr
835
838
return utils . getQueryParam ( Constants . AMP_DEVICE_ID_PARAM , urlParams ) ;
836
839
} ;
837
840
841
+ /**
842
+ * Try to fetch referrer from url params.
843
+ * @private
844
+ */
845
+ AmplitudeClient . prototype . _getReferrerFromUrlParam = function _getReferrerFromUrlParam ( urlParams ) {
846
+ return utils . getQueryParam ( Constants . AMP_REFERRER_PARAM , urlParams ) ;
847
+ } ;
848
+
838
849
/**
839
850
* Parse the domain from referrer info
840
851
* @private
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ export default {
50
50
REVENUE_REVENUE_TYPE : '$revenueType' ,
51
51
52
52
AMP_DEVICE_ID_PARAM : 'amp_device_id' , // url param
53
+ AMP_REFERRER_PARAM : 'amp_referrer' , // url param for overwriting the document.refer
53
54
54
55
REFERRER : 'referrer' ,
55
56
You can’t perform that action at this time.
0 commit comments