Quantcast
Channel: Active questions tagged ampscript - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 359

Passing SubscriberKey from CloudPage to JavaScript file

$
0
0

I have a custom preference center built in CloudPages. Also have a separate code resource file (RetrieveMemberdata.js) which contains all my AMPScript.This file is invoked from CloudPage using tag as below.Below is the snippet from my CloudPage -

</style>  %%[Set @subkey = _subscriberkey]%%<script type="text/javascript" src="http://cloud.homes.xyz.email/RetrieveMemberdata.js"></script></head><body class="typical ">

Now in the JS file (RetrieveMemberdata.js), I want to be able to access the value of this subscriberkey. Once I am able to obtain it, there is a lot of logic that will be executed using AMPScript in this file. I tried using the below but it doesn't work

var RetrievedInfo = {};var RetrievedContactInfo = {};var subskey= Variable.GetValue("@subkey");%%[ VAR @email, @count, @IsValid, @IsContact........]%%

Help will be much appreciated


Viewing all articles
Browse latest Browse all 359

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>