How to implement Adobe Analytics with Ruby on Rails - alcazes/Adobe-Analytics-from-A-To-Z GitHub Wiki

Upload all Adobe files to your vendor folder

1.] In your Ruby on rails project go to \vendor\assets\javascripts

2.] Create a folder named "adobe"

3.] Open the folder adobe and upload your AppMeasurement.js and VisitorAPI.js file

AppMeasurement.js should contain the Adobe Analytics main library and the configuration for Adobe Analytics

VisitorAPI.js is only required if you use Adobe Marketing Cloud Visitor ID services. It should contain the VisitorAPI main library followed by the configuration of Visitor ID services

4.] Create a file index.js in \vendor\assets\javascripts\adobe

5.] Open index.js and paste the following code

//= require ./VisitorAPI.js
//= require ./AppMeasurement.js

6.] Now go to \app\assets\javascripts and open application.js

7.] Add the following in the file

//= require adobe

Create a footer partial to send Adobe Analytics image request

1.] Go to \app\views\layouts

2.] Create _footerAA.html.erb

3.]Put the Adobe Analytics code in this file

<script language="JavaScript" type="text/javascript"><!--
//Add any variables that you need
s.pageName="Adobe Analytics test RUBY";

/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
var s_code=s.t();if(s_code)document.write(s_code)//--></script>
<script language="JavaScript" type="text/javascript"><!--
if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-')
//--></script>

4.] Call your Partial in your application.html.erb

<%= render 'layouts/footerAA' %>

5.] Check that the image request is sent

⚠️ **GitHub.com Fallback** ⚠️