Highlighted

Banner View and Click tracking in Mobile App

Sudha_Rani 04-12-2017

Hi There! we have an Activity running on Mobile App where we have the below code to track Banner views and Clicks. Unfortunately this isn't working. Would you where we are going wrong?

Offer Code

function displayoffer(mainText,redirectID,btnText,deepKey) {

var headText = mainText;

var btn = btnText;

$('#myaccounts-bottom-slider').prepend('<div id="App_Demo1" class="POCDemo1_offer_innerDisplayDiv ${campaign.recipe.name}" style="display: inline-block;"><p class="POCDemo1_offer_Bold">'+

headText+'</p><div id="button" class="POCDemo1_offer-button">'+'<a id="Demo1CTA" type="button">'+btn+'</a></div></div>');

var action = "account overview DemoPOC2 Rec B bannerView";

cData.put("cd.pageName","App:POC2:BannerView");          //Got this Syntax from offshore SC team

trackAction(action, cData);

var learnMore = document.getElementById("Demo1CTA");

    learnMore.addEventListener("click", function() {

var action1 = "account overview QPOC2 Rec B bannerClick";

cData.put("cd.campaign_code","123456"); 

cData.put("cd.pageName","App:POC2:BannerClick");    

trackAction(action1, cData);

var target = {};

target.key=deepKey;

setTimeout(function(){$(window).trigger('deep_link', target)},100);

document.getElementById('App_Demo1').style.display = "none";

return;

Replies

Highlighted
Highlighted
vinodh_dinakar1 08-12-2017

Amelia,

Let me give you a background of the issue;

I have a mobile app (android/ios) that has analytics SDK implemented in it. It uses context data variables to send data to SC. I am running an experiment via Adobe Targetn on the app. Now, my requirement is this:

When the banner loads on the mobile app, I want to trigger an analytics calls i.e. trackAction or trackState that says something like pagename = "banner_seen"

when the user clicks on the banner, I want to trigger an analytics calls i.e. trackAction or trackState that says something like pagename = "banner_clicked"

How can i do this? from the offer code of my experiment, I cannot trigger a trackAction or trackState. So, how can i pass the values like "banner_seen" or "banner_clicked" over to SC?