I generate an object with parameters. It's a mix of custom ones that I create (no $) or the SDK that I have integrated generated a bunch with $:
{$campaign_id: 471764, $campaign_name: TPUSA, $channel: email, $first_match: false, $first_match_link: false, $guaranteed_match: true, $link_id: 504455, $link_name: TPUSA Demo, $reinstall: false, $suspicious: false, $token: tpusademo, creatorID: timfong888, referralID: tpusa-demo}
I am able to access the params without $ but get one with it:
socialdata.creator.value = globalReferralData.linkParams['creatorID'];
socialdata.campaign.value = globalReferralData.linkParams['$campaign_id'];
Is there something I need to do to access the values that have $ without an error (I get an error for $campaign_id.
CodePudding user response:
You can either escape the $
by putting \
before the $
like: '\$campaign_id'
.
Or specify you want a raw string where every character should be read as they are written by putting an r
before the string definition like: r'$campaign_id'