5252 var city = prompt ( 'Input city' , 'San Francisco, CA' ) ;
5353 amplitude . setUserProperties ( { city : city } ) ;
5454 } ;
55+ var addToPhotoCount = function ( ) {
56+ var photoCount = parseInt ( prompt ( 'Input amount to increment photo count by' , '2' ) , 10 ) ;
57+ amplitude . identify ( new amplitude . Identify ( ) . add ( 'photoCount' , photoCount ) ) ;
58+ }
5559 var clickOnLinkA = function ( ) {
5660 amplitude . logEvent ( 'Clicked on link A' , null , function ( ) { window . location = 'https://www.google.com' ; } ) ;
5761 } ;
62+ var setPhotoCount = function ( ) {
63+ var photoCount = parseInt ( prompt ( 'Input photo count to set' , '2' ) , 10 ) ;
64+ amplitude . identify ( new amplitude . Identify ( ) . set ( 'photoCount' , photoCount ) ) ;
65+ }
66+ var setOncePhotoCount = function ( ) {
67+ var photoCount = parseInt ( prompt ( 'Input photo count to setOnce' , '2' ) , 10 ) ;
68+ amplitude . identify ( new amplitude . Identify ( ) . setOnce ( 'photoCount' , photoCount ) ) ;
69+ }
5870</ script >
5971< script >
6072 amplitude . init ( 'a2dbce0e18dfe5f8e74493843ff5c053' ) ;
6173 amplitude . setVersionName ( 'Web' ) ;
6274 amplitude . identify ( new amplitude . Identify ( ) . add ( 'photoCount' , 1 ) ) ;
63- // amplitude.identify(new amplitude.Identify().add('photoCount', 1).set('gender', 'male').unset('karma'); );
75+ amplitude . identify ( new amplitude . Identify ( ) . add ( 'photoCount' , 1 ) . set ( 'gender' , 'male' ) . unset ( 'karma' ) ) ;
6476 amplitude . logEvent ( 'pageLoad' ) ;
6577</ script >
6678< body >
@@ -71,13 +83,16 @@ <h3>Amplitude JS Test</h3>
7183 < li > < a href ="javascript:logEvent(); "> Log event</ a > </ li >
7284 < li > < a href ="javascript:amplitude.logEvent('clicked button', {color: 'red;', shape: 'triangle', sides: 3}); "> Log
7385 event with event properties</ a > </ li >
74- < li > < a href ="javascript:amplitude.setUserProperties({age: 30, city: 'San Francisco, CA'}); "> Set user properties</ a >
75- </ li >
86+ < li > < a href ="javascript:amplitude.setUserProperties({age: 30, city: 'San Francisco, CA'}); "> Set user properties</ a > </ li >
7687 < li > < a href ="javascript:amplitude.options.batchEvents = !amplitude.options.batchEvents; "> Toggle batch events</ a > </ li >
7788 < li > < a href ="javascript:setEventUploadThreshold(); "> Set event upload threshold</ a > </ li >
78- < li > < a href ="javascript:amplitude.identify(new amplitude.Identify().add('photoCount', 1)); "> Increment photo count</ a > </ li >
79- < li > < a href ="javascript:setCity(); "> Set city via setUserProperties</ a > </ li >
80- < li > < a href ="javascript:amplitude.identify(new amplitude.Identify().unset('photoCount')); "> Unset photo count</ a > </ li >
8189 < li > < a href ="javascript:clickOnLinkA(); "> Click on link A</ a > </ li >
90+ < br > < br > Testing Identify calls< br >
91+ < li > < a href ="javascript:addToPhotoCount(); "> Add to photo count</ a > </ li >
92+ < li > < a href ="javascript:amplitude.identify(new amplitude.Identify().unset('photoCount')); "> Unset photo count</ a > </ li >
93+ < li > < a href ="javascript:setPhotoCount(); "> Set photo count</ a > </ li >
94+ < li > < a href ="javascript:setOncePhotoCount(); "> Set photo count once</ a > </ li >
95+ < li > < a href ="javascript:setCity(); "> Set city via setUserProperties</ a > </ li >
96+
8297</ body >
8398</ html >
0 commit comments