Join our Community in its new Home - The Datorama Trailblazer Community Group!

It's been an amazing 3 years coming together in this forum to collaborate, innovate, support, and inspire each other about our shared usage of Datorama. While this is not quite a goodbye, we are excited to announce that we are getting a fresh start in our new home within the Salesforce Trailblazer Community. We have a ton of fun new content planned and you may even see the revival of some of our most popular posts from the past few years.

We’ll be keeping this group around for a bit for you to peruse, but as of November 15, we will no longer be allowing new posts or comments. Be sure to join our new group at to keep the conversation going.

We can’t wait to see you there!

Custom Widget for Top Performing Instagram Creative

EmilyEmily New YorkSYS_ADMIN IMG42

Locate and Isolate the Creative Image data

1.  Find the unique field in the Instagram data streams that has the creative image data link. It could be: csv['post_link']

2. Prepare the link for usage: Isolate and format the link using the two Calculated Dimensions below

Dimension 1:

<p>var instaLink = EXTRACT([Social_Post_Link],'/',5);</p><p>if (([Data_Stream] contains 'Instagram'){<br>return instaLink;<br>}else {<br>return null;<br>}</p>

Dimension 2: 

var link = ''+<b>[The Top Calculated Dimension Above]</b>+'/embed';

**Note the bold in dimension 2 indicates that it references the first calculated dimension

Construct the Custom Widget

1.  In the Customer Widget Editor construct this HTML (Note that the HTML below includes a line for number of clicks which could be brought in with another query if desired). 

<p><h1>#1 Post</h1></p><p><br><div id="frame" style="margin-left: 0%;"></p><p><br><iframe style="height: 100%; overflow: hidden; width: 100%;"<br>id="instaFrame" scrolling="no" border="0" frameborder="0"<br>src="about:blank"<br>sandbox="allow-scripts allow-forms allow-top-navigation allow-popups allow-same-origin"></iframe></p><p><br></div></p>

2.  Create a Custom Widget and in the add data section query the Creative Image dimension/calculated dimension made above. 

3.  JavaScript (the highlighted code is required, but the non-highlighted code is useful for troubleshooting the resulting query from within the console): 

<p>var queryResult = DA.query.getQueryResult();</p><p><br>var result = queryResult["rows"][0][0]['value'];</p><p><br>console.log(JSON.stringify(queryResult));</p><p><br>console.log(result);</p><p><br>document.getElementById('instaFrame').src = result;</p>

**Note that by changing the '0' in the code below to '1' you can get the second row in the query and thus have the next row of best performing creatives based on clicks; then the third, etc., each in their own custom widget which would allow for multiple creatives on a dashboard page.

var result = queryResult["rows"][1][0]['value'];

4.  Save your custom widget

5.  Set the sort method by the KPI that is most important to determine the creative's success. 

6. Adjust the widget settings to filter out any null values coming in for the creative link

              Sign In or Register to comment.