Find a word in a string using JavaScript

To find a word in a string using JavaScript get I will be showing 2 methods to achieve this:

Method 1:

JavaScript String includes() Method

The includes() method determines whether a string contains the characters of a specified string. This method returns true if the string contains the characters, and false if not. Note: The includes() method is case sensitive.

var str = "Hello world, welcome to the ourpcgeek";
var n = str.includes("ourpcgeek");
var str = "Hello world, welcome to the ourpcgeek";
var test= "ourpcgeek";
var n = str.includes(test);

Put the above sample code in console and see the output.

Definition and Usage

The includes() method determines whether a string contains the characters of a specified string.

This method returns true if the string contains the characters, and false if not.

Note: The includes() method is case sensitive.

Click here to see demo

Method 2:

Other method is using RegEx

Following script will find and replace:

var stringToGoIntoTheRegex = "ourpcgeek";
var regex = new RegExp("#" + stringToGoIntoTheRegex + "#", "g");
// at this point, the line above is the same as: var regex = /#ourpcgeek#/g;

var input = "Hello this is #ourpcgeek# some #ourpcgeek# stuff.";
var output = input.replace(regex, "!!");
alert(output); // Hello this is !! some !! stuff.

Following script will find and if there is match then it is show +ve number.

var stringToGoIntoTheRegex = "ourpcgeek";
var regex = new RegExp("#" + stringToGoIntoTheRegex + "#", "g");
// at this point, the line above is the same as: var regex = /#ourpcgeek#/g;

var input = "Hello this is #ourpcgeek# some #ourpcgeek# stuff.";
var output =;
alert(output); // Will show positive no. as there is match and the no. will be the location

Following script will find and if there is no match then it is show -ve number.

var stringToGoIntoTheRegex = "xyz";
var regex = new RegExp("#" + stringToGoIntoTheRegex + "#", "g");
// at this point, the line above is the same as: var regex = /#ourpcgeek#/g;

var input = "Hello this is #ourpcgeek# some #ourpcgeek# stuff.";
var output =;
alert(output); // Will show -ve number as there is no match

In the general case, escape the string before using as regex:
Not every string is a valid regex, though: there are some special characters, like ( or [. To work around this issue, simply escape the string before turning it into a regex. A utility function for that goes in the sample below:

What are Data Collection Steps of Adobe Analytics?

  1. A visitor visits a web page that contains the data collection code.
  2. As the page loads, the data collection code sends an image request (called a web beacon) to Adobe data collection servers. The image request contains the data you want to collect about the visitors’s interaction with your website.
  3. Adobe stores the data in report suites. You can log in to access report suite data and generate reports related to visitor activity on your website.

Data collection is very quick and does not noticeably affect page load times. Collected data includes page views that result from clicking the browser Reload or Back buttons. The Javascript code runs even when the page is retrieved from cache.

Processing Order of Adobe Analytics:

What is Adobe Analytics?

It’s the industry-leading solution for applying real-time analytics and detailed segmentation across all of marketing channels. Use it to discover high-value audiences and power customer intelligence for business.

What Adobe Analytics can do?

Reporting provides insights into your traditional web-based channels as well as evolving channels like mobile, video, and social networking. Some examples of marketing reports include:

  1. How many people visit your site
  2. How many of those visitors are unique visitors (counted only once)
  3. How they came to the site (such as whether they followed a link or came there directly)
  4. What keywords visitors used to search site content
  5. How long visitors stayed on a given page or on the entire site
  6. What links visitors clicked, and when they left the site
  7. Which marketing channels are most effective at generating revenue or conversion events
  8. How much time they spent watching a video
  9. Which browsers and devices they used to visit your site

How to Install WordPress on WampServer

After you’ve installed WampServer, follow these steps to install WordPress on WampServer:

(Though, WordPress 3.3.1 was used for this tutorial, you will find it helpful for any version of WordPress.)
NOTE: I will suggest not to change the names I’ve used in the tutorial, else you can find yourself in trouble. Please only change names if you’re sure you can keep up with the changes.

1. Goto Computer -> C:drive There you will see a folder named ‘wamp’.

2. Open wamp -> www

3. Create a new folder here, named ‘testsite’ (without quotes). You can keep any name but note it down as it’s your site name and replace ‘testsite’ with your chosen name when it is used in upcoming steps.

4. Now, goto the WordPress setup file (which you downloaded in step 2 of downloading files). Open the zip file named ‘’ (your’s filename can be changed because of different WordPress version), open folder named ‘wordpress’ and copy/extract its contents to our newly created folder ‘testsite’ [or the name you gave] (created in above step 3 of installing WordPress).
5. Till time, your site folder ‘testsite’ should look like this:

6. Open Start menu -> All programs -> WampServer and click ‘Start WampServer’.
Click ‘Yes’ on any UAC dialog window shown. Now, WampServer will be running on your system and you can see its icon in notification area.
7. Lets confirm your WampServer is working properly. Open your browser (I prefer Firefox as Internet Explorer loads slowly) and type ‘localhost’ (without quotes) in the address/location bar. You will see this page:

8. Click ‘phpmyadmin’ under Tools section.

9. Click ‘Databases’.

10. Type ‘testsitesql’ (without quotes) in the text box below Databases and click create. MySQL database for your WordPress site on WampServer is ready.

11. Type ‘localhost/testsite’ (without quotes) in the location bar of your browser. You will see this:

12. Click on ‘Create Configuration file’ button.

13. Click on ‘Let’s go’ button.
Enter ‘testsitesql’ as Database name and ‘root’ as username. Make Password box blank (you don’t need to write any password for MySQL database). And leave rest two fields intact. Now, click on ‘Submit’ button.

14. Click on ‘Run the Install’.

15. Enter your site name, username, password, email, etc. and click on ‘Install WordPress’ button.

16. Now, you’re almost done. You will see the success message. Click on ‘Log In’ button.

17. Enter your chosen username and password (which you chose in step 15) and click ‘Log In’ button.
18. Bravo! WordPress installation is finally complete. You’ve successfully login in WordPress on your WampServer. You will see the welcome message.

Now, you can enjoy using the best ever-built blogging tool on the planet. Some of the places to begin exploring WordPress is Appearance -> Themes and Settings. I hope you enjoyed the tutorial and found it helpful.

Feel free to share this and do let me know through comment that how it works.

SalesForce and Adobe Analytics Integration

Following can be expectation from:

  1. Want two way integration between Adobe Analytics and SFDC
  2. Ready made connector is not available under Data Connector so custom solution has to be designed for that.

There are  couple of ways by which data can be sent from Adobe Analytics to SFDC.

  1. Data warehouse API to send data in SFDC
  2. Reporting API to send data to SFDC
  3. Data Extract report and inject that into SFDC
  4. Data Warehouse report and inject that into SFDC
  5. Data feeds: Receive an hourly or daily export of raw data. Every row is an individual hit, and every column is a variable. Data feeds are typically sent to FTP sites. Inject the file into SFDC

There are  couple of ways by which data can be sent from SFDC to Adobe Analytics.

  1. Use Data Source API
  2. Use Data Source FTP

Before opting the solution do POC in terms of dimension and metric which need to be imported and exported. That will help to decide that which method or option is good to go forward.

Learn Natural Language from scratch to expert level

Here is the list of resources to learn Natural Language from scratch to expert level:

● Jason Brownlee – What Is Natural Language Processing:

● Emmanuel Ameisen How to solve 90% of NLP problems:

● Analytics Vidhya – Regular Expressions in Python:

● Analytics Vidhya – Ultimate Guide to Understand & Implement Natural Language Processing:

● Harrison Kinsley – Natural Language Processing With Python and NLTK:

● Coursera – Natural Language Processing:

● Siraj Raval – Word2Vec Tutorial:

● Stanford – Deep Learning for Natural Language Processing:

● Siraj Raval – How to Make a Text Summarizer


● Siraj Raval – How to Generate Your Own Wikipedia Articles:

Testing and Debugging in Adobe Analytics

Testing and Debugging are significant activities and it is required to capture the information in Analytics variable that in case it is required at sme point of time.

Following are the value one should capture in AA variable:

Page URL:

To capture the URL you can use the following line of JS code

location.protocol + ‘//’ + + location.pathname;

Query String:


AppMeasurement code version:



If the TMS is Adobe Launch or DTM you can use the below line of code.


If visitorID.js is implemented by other method then use the following JS to capture the value of mid into Adobe Analytics Variable:


VisitorAPI.js version

var VI= s_c_il[0].version;
return VI;

For all concatenated detail:


To segregate you can use following code :

var fullcode=scVersion.split(‘|’);
var codeversion=fullcode[1];
var VI=fullcode[2];

IP Address:

Check legal/country/company policy before capturing this into AA variable.

User Agent:


There are 2 options to do this.

  • Put the value of IP in Data Layer and then populate that into AA variable
  • Use processing rule and populate the value into AA variable

Hope this helps to pick the testing and debugging parameter.

To test on how this works do to Adobe Launch TMS and add Adobe Analytics Extension. Under custom code add the following line of code, build the version and see the result under browser console:

// Extract Adobe Analytics core attributes for user session
var visitorAPI = s_c_il[0].version;
var visitorId = _satellite.getVisitorId().getMarketingCloudVisitorID();
var s_Code = s.version;
console.log(“visitorId: ” + visitorId);
console.log(“visitorAPI: ” + visitorAPI);
console.log(“s_Code: ” + s_Code);

Use of Tracking Server in Adobe Analytics in case of Domain and Sub Domain

Adobe collects data on your site by receiving an image request generated by the visitor. The trackingServer variable determines the location an image request is sent. If this variable is not defined correctly, your implementation can experience data loss.

Tracking server can be 3rd party tracking server or first party tracking server.

Host name is required for the setup of FPC.

Hostname can be

As an example we can pick following for

  • For secure you can pick
  • For non-secure you can pick


  • For secure you can pick
  • For non-secure you can pick

A tracking server is considered as First party when the tracking server contains the domains in it and you have to use that tracking server against that domain only.

For example: will be treated as first party only for domain and its subdomains.
If you try to use it with any other domain(like here domain is, it will be treated as Friendly third party tracking server.

Also is the subdomain of hence we do not need to set up tracking server separately for

We can use for both and It will be treated as First party for both of them.