The defendant appeals from convictions, after a jury trial in the Superior Court, of two counts of unlawful distribution of cocaine, G. L. c. 94C, § 32A(c).1 He raises four evidentiary claims: (1) testimony describing the process by which the informant was authorized to serve as such and participate in controlled drug buys (controlled buys) constituted improper vouching; (2) testimony indicating the informant had purchased cocaine from the defendant before the dates of the indicted offenses constituted impermissible prior bad act evidence; (3) testimony indicating law enforcement personnel were assigned to a gang task force was improper as it was irrelevant and prejudicial; and (4) the admission of drug analysis certificates (certificates) violated the defendant’s rights under the confrontation clause of the Sixth Amendment to the United States Constitution. Additionally, the defendant claims he received ineffective assistance of counsel in the failure of trial counsel to object to these evidentiary matters (with the exception of the prior bad act testimony), and that cumulative error created a substantial risk of a miscarriage of justice. We affirm.
Background. We summarize the facts as the jury could have found them, reserving certain details for discussion of the issues.
Four people testified for the Commonwealth: Trooper Fred *866Geiger of the Massachusetts State police; Officer Robert Lockett of the Chicopee police department2; Special Agent Christopher Dillon of the Federal Bureau of Investigation (FBI); and Charles Smith, an informant who participated in two controlled buys from the defendant. Geiger first met Smith in February, 2006.3 Smith told Geiger that he had information about drug dealing and expressed his willingness to make controlled buys. He named several drug dealers, including the defendant, and while Smith worked with law enforcement on several cases, the defendant was one of the persons they first targeted.
On February 16, 2006, at the FBI office in the presence of Geiger, Smith called the defendant to arrange a purchase of cocaine for the next day. On February 17, Smith again met the officers at the FBI office; Smith called the defendant and established a meeting at 55 Dearborn Street in Springfield. Geiger searched Smith’s person and car, including those areas where a one-quarter ounce bag of cocaine (such as that later marked as an exhibit) could be secreted, to ensure that Smith was not in possession of money, weapons, or narcotics. Smith was outfitted with a covert audio and video recorder, which provided a live audio feed for Smith’s safety. The agents activated the equipment and provided Smith with $275 in buy money.4 Smith and Geiger drove to Dearborn Street separately, with Geiger following Smith.5 Geiger was aware that Smith’s car had been having problems, and several times during the drive, Smith stopped the car and checked under the hood. Geiger testified that he could not see what Smith did while he was under the hood.
When Smith arrived at Dearborn Street, he called the defendant and was told to pull into the driveway, which is where the two met. During the minute or two that the defendant and Smith were together, Geiger could see the defendant in person. The video showed the defendant reach into his pocket and then, later, *867hold currency in his hand. However, the video did not show the exchange of drugs for money that Smith described in his testimony. Smith drove directly back to the FBI office with Geiger following. Geiger had maintained visual contact with Smith the entire time the video equipment was taping. Smith explained what had transpired and gave the substance he purchased from the defendant to Geiger. Geiger again searched Smith and his car and found nothing of consequence.
Geiger and Smith next met on February 28, 2006, to set up the second controlled buy. They followed the same procedures as the first occasion, with the exception that this time Smith was directed to purchase a certain amount of cocaine and given a digital scale. Smith was told to inform the defendant that he wanted to weigh the dmgs because he had been “shorted” the first time. Geiger again followed Smith and kept him under surveillance to the prearranged location, Smokin’ Deals, a store in Springfield. Geiger was also in contact with Smith by cellular telephone. Geiger saw Smith arrive at the location and saw the defendant and Smith together in a car for less than a minute. Geiger continued to observe Smith as he drove back to the FBI office. Once back at the office, the same debriefing and search procedures as before were followed. Again, the search of Smith and his car turned up nothing of consequence.
After each controlled buy, Geiger field tested the substances obtained from the defendant, then sent them to a lab for analysis. Both the field tests and laboratory analyses indicated the substances were cocaine.
Discussion. Vouching. The defendant claims that testimony on the process used to obtain approval to use Smith as an informant and controlled buyer constituted impermissible vouching. As the defendant did not object to this testimony, “we review to determine whether the statements were improper and, if so, whether they created a substantial risk of a miscarriage of justice.” Commonwealth v. Kebreau, 454 Mass. 287, 304 (2009).
In particular, the defendant’s claim is based on the testimony of Trooper Geiger and Special Agent Dillon describing the process necessary for Smith to become a government informant and participate in controlled buys. Geiger testified that he introduced Smith to “one of the controlling FBI agents,” submit*868ted information about Smith’s criminal history to the FBI, consulted with the United States Attorney’s office, and tested Smith’s veracity. Geiger indicated that as Smith “pass[ed] a certain standard,”, he was given a code name and authorized to make controlled buys. Dillon testified that the process used to decide whether to enlist an individual as an informant involved an “extensive background” check and the corroboration of information provided by that individual to determine “if it holds any water.”
The Supreme Judicial Court has recognized that prosecutors must not explicitly or implicitly vouch for the truthfulness of a witness’s testimony. Commonwealth v. Ciampa, 406 Mass. 257, 265 (1989). Furthermore, “[b]ecause police witnesses may also introduce . . . prejudice by vouching for cooperating witnesses ... the proscription against vouching . . . should extend to them as well.” Commonwealth v. Chaleumphong, 434 Mass. 70, 74 (2001). Here, neither Geiger nor Dillon vouched for the truthfulness of Smith, since they never “expresse[d] a personal belief in the credibility of [Smith] . . . , [nor indicated] that [they] ha[d] knowledge independent of the evidence before the jury verifying [Smith’s] credibility.” Ciampa, supra (citation omitted).
The defendant has not identified any testimony, by either Geiger or Dillon, that specifically vouched for Smith’s testimony describing the two controlled buys. Further, while details regarding the approval process were subject to exclusion upon relevance grounds, see Mass. G. Evid. § 403 (2010), considered in context, the challenged testimony clearly demonstrated that the officers engaged in this verification only to determine whether the names and information Smith provided were fictitious. The unmistakable tenor of Geiger and Dillon’s testimony about this “verification” was that Smith would not have been permitted to participate in controlled buys, handling drugs and money, without it.
Furthermore, admitting hearsay evidence of Smith’s past relationship with the police does not make the Geiger and Dillon testimony improper. Compare Commonwealth v. LaVelle, 414 Mass. 146, 155-156 (1993) (rejecting claim judge erred by admitting hearsay evidence bolstering informant’s credibility, as hearsay statements in detective’s testimony on informant’s initial *869contacts with police, knowledge of drug trafficking activity, motives for aiding police, participation in undercover operation, and statements concerning defendant were admissible as relevant to state of police knowledge that led them to use informant and pursue defendant as possible drug trafficker). “While the testimony of [Geiger and Dillon] as to statements made by [Smith] is clearly hearsay, ‘[t]he hearsay rule forbids only the testimonial use of reported statements. It does not preclude the use of such statements for other valid purposes such as . . . the state of police knowledge which impelled the approach to the defendant.’ Commonwealth v. Miller, 361 Mass. 644, 659 (1972). See Commonwealth v. Bradshaw, 385 Mass. 244, 269-270 (1982) (prosecutor entitled to present full picture of events surrounding the incident). After reviewing [Geiger’s and Dillon’s] testimony, we affirm the trial judge’s determination that, to the extent the testimony included hearsay statements, the information was relevant to the state of police knowledge which led them to use [Smith] as an informant and to seek out [the defendant] as a possible drug trafficker.” LaVelle, supra.
Prior bad act testimony. The defendant contends that the judge impermissibly allowed Smith to testify that before he became an informant he had purchased drugs from the defendant. The judge gave a limiting instruction contemporaneous with this testimony and included the same instruction in his final jury instructions. As the defendant preserved this claim with a contemporaneous objection, we review the judge’s action for prejudicial error, which involves a two-part analysis: “(1) was there error; and (2) if so, was that error prejudicial. An error is not prejudicial if it ‘did not influence the jury, or had but very slight effect’; however, if we cannot find ‘with fair assurance, after pondering all that happened without stripping the erroneous action from the whole, that the judgment was not substantially swayed by the error,’ then it is prejudicial.” Commonwealth v. Cruz, 445 Mass. 589, 591 (2005), quoting from Commonwealth v. Flebotte, 417 Mass. 348, 353 (1994).
“It is well settled that the prosecution may not introduce evidence of a defendant’s prior or subsequent bad acts for the purpose of demonstrating bad character or propensity to commit the crime[s] charged.” Commonwealth v. Barrett, 418 Mass. 788, 793 (1994). Such evidence, however, “is admissible for *870other relevant probative purposes.” Commonwealth v. Cordle, 404 Mass. 733, 744 (1989), S.C., 412 Mass. 172 (1992), quoting from Commonwealth v. Gallison, 383 Mass. 659, 672 (1981). A range of permissible relevant purposes have been recognized in our law, including “to show a common scheme or course of conduct, a pattern of operation, absence of accident or mistake, intent, or motive.” Barrett, supra at 794. See Commonwealth v. Ashman, 430 Mass. 736, 741 (2000) (prior bad act evidence admissible to show defendant’s state of mind, intent, and relationship with victim). See also Mass. G. Evid. § 404(b). The evidence is not admitted to directly prove an element of the crime charged “but merely as circumstantial evidence tending to establish, by inference, one factor relevant to the determination of guilt, e.g., the inference that motive leads to intent, or common scheme leads to the absence of mistake.” Barrett, supra at 795. The judge must also find that the probative value of the evidence in question outweighs the risk of undue prejudice to the defendant. See Commonwealth v. Helfant, 398 Mass. 214, 225 (1986).
We think the judge appropriately considered whether the relevance of this evidence, to establish the nature of the relationship between Smith and the defendant, outweighed the possible prejudice to the defendant. Moreover, the amount of evidence of the prior episodes was minor in comparison with that of the incidents at issue and did not “divertQ the attention of the jury from the [crimes] immediately before it,” Commonwealth v. Triplett, 398 Mass. 561, 563 (1986), quoting from Commonwealth v. Jackson, 132 Mass. 16, 20 (1882), or overwhelm the evidence of the incident at issue in this case. Lastly, the judge gave an appropriate and complete hmiting instruction to the jury contemporaneously with the testimony and also as part of his final instructions. In both instructions, the judge informed the jury that the evidence of prior drug transactions was not to be used by them as any indication of guilt on the instant charges, and it was only to be considered on the issue of Smith’s familiarity or knowledge of Sullivan.6 We see no error.
Gang unit assignments. The defendant complains that refer*871enees to an unrelated gang investigation were error.7 We disagree. The defendant failed to object; thus, “we review to determine whether the statements were improper and, if so, whether they created a substantial risk of a miscarriage of justice.” Kebreau, 454 Mass. at 304.
Here, the evidence did not associate the defendant with a gang, nor did the prosecutor, in witness examination or in closing argument, suggest or intimate such an association. It was clear that the police targeted the defendant as a result of the information from Smith about his prior dealings with the defendant. Thus, “the jury could not have reasonably inferred . . . *872that the defendant was a gang member,” Commonwealth v. Wilson, 441 Mass. 390, 399 (2004), because the references to gang-related assignments were isolated, fleeting, and completely unrelated to the theory and evidence against the defendant. Compare id. at 399-400 (no substantial risk of miscarriage of justice where, although there was evidence that an officer served on the gang unit, “there was no other evidence introduced at trial that indicated the defendant or any of the other men in the group were members of a gang, and no reference to gang membership was made by the prosecutor in closing argument”). As these references had a negligible effect, if any, upon the verdicts, they created no substantial risk of a miscarriage of justice.
Drug certificates. The admission of the two drug certificates without the opportunity for cross-examination of the chemical analyst was error. Melendez-Diaz v. Massachusetts, 129 S. Ct. 2527, 2532 (2009). Notwithstanding the absence of an objection, the Supreme Judicial Court has held that the defendant is entitled to the standard of review for preserved constitutional errors.8 Commonwealth v. Vasquez, 456 Mass. 350, 352 (2010). In making our determination whether the instant error is harmless beyond a reasonable doubt, “we ask whether ‘on the totality of the record before us, weighing the properly admitted and the improperly admitted evidence together, we are satisfied beyond a reasonable doubt that the tainted evidence did not have an effect on the [fact finder] and did not contribute to the [fact finder’s findings].’ ”9 Id. at 360, quoting from Commonwealth v. Tyree, 455 Mass. 676, 701 (2010). We conclude that the Commonwealth has satisfied its burden of proving that *873the error was harmless beyond a reasonable doubt. See Commonwealth v. Vardinski, 438 Mass. 444, 452 (2003).
“Proof that a substance is a particular drug need not be made by chemical analysis and may be made by circumstantial evidence,” including the testimony of properly qualified police and drug-user witnesses. Commonwealth v. Dawson, 399 Mass. 465, 467 (1987). Smith and Geiger both testified, without objection, that the substances purchased from the defendant appeared to be cocaine. We recognize that “it would be a rare case in which [witness statements] that a particular substance looked like a controlled substance would alone be sufficient to support a conviction.” Ibid. Here, however, the evidence of the nature of the substance, independent of the certificates, was “ ‘overwhelming,’ in the sense that it [was] ‘so powerful as to “nullify any effect” ’ that the improperly admitted evidence ‘might have had’ on the fact finder or the findings.” Vasquez, supra at 362, quoting from Tyree, supra at 704 n.44. See generally Commonwealth v. Rodriguez, 456 Mass. 578, 591 (2010), quoting from Tyree, supra at 701 (“under harmless error review, it is not enough for the Commonwealth to show that the evidence apart from the certificate was ‘ “sufficient” to convict the defendant’ or that the certificate was ‘ “consistent” with the admissible evidence’ ”); Commonwealth v. Fluellen, 456 Mass. 517, 526 (2010) (under harmless error review, “[w]e look beyond evidentiary sufficiency and consider the actual impact of the tainted evidence on the jury”).
First, Smith (who testified without objection that the substances appeared to be cocaine) admitted that he had been a cocaine addict and that he had used cocaine for about three years. Smith’s identification of the substances therefore rested on a long history of cocaine use. Compare Commonwealth v. Villatoro, ante 645, 652-654 (2010) (judge entitled to infer that witness, who testified to long history of marijuana use, was able to identify marijuana and competent to testify on subject). “[A] witness need not have used the substance on the occasion in question in order to testify as to its nature. It is enough that the witness have familiarity based on prior use or sale. . . . ‘[Identification based on past use coupled with present observation of the substance at hand will suffice to establish the illicit nature of a *874suspected substance.’ ” Commonwealth v. Cantres, 405 Mass. 238, 246-247 (1989), quoting from United States v. Harrell, 737 F.2d 971, 978-979 (11th Cir. 1984), cert. denied, 469 U.S. 1164 (1985), and 470 U.S. 1027 (1985). Additionally, Geiger, who also testified without objection that the substances appeared to be cocaine,10 was trained and experienced in narcotics identification. He testified that he had been a State trooper for seven years; that he had been extensively trained in narcotics familiarization at local, State, and DEA police academies; that he had taken advance training courses and received in-service training; and that he had made in excess of 1,000 drug arrests.11 Compare Commonwealth v. Connolly, 454 Mass. 808, 831 (2009) (officer, who had thirteen years’ experience conducting drug searches with narcotics detection canine, testified substance appeared to be cocaine; error harmless). Contrast Vasquez, 456 Mass. at 364 (absence of evidence officers had specialized training or experience; error not harmless); Commonwealth v. Charles, 456 Mass. 378, 381-382 (2010) (same).
Finally, and most significantly, Geiger testified on redirect and recross-examination that after each controlled buy, he performed a field test on the substance purchased from the defendant. Geiger testified that he had been trained, tested, and certified to conduct field tests, and he described in detail the field test materials and procedures. He also testified, without objection, that the substances tested positive for cocaine. Compare Connolly, supra (officer with twenty-five years’ experience in narcotics investigations testified he field tested substances purchased during controlled buys and each tested positive for cocaine; officer with seventeen years’ experience in narcotics investigations testified he field tested substance found in minivan and it tested positive for cocaine; error harmless); Commonwealth v. Rodriguez, 75 Mass. App. Ct. 235, 243 (2009) (detective testified some of the substances were field tested and *875found to be cocaine; error harmless). Contrast Vasquez, supra (no evidence of field tests; error not harmless); Fluellen, 456 Mass. at 527 (same).
In addition to the above evidence that the substances were cocaine, we note that the theory of the defense, as indicated in counsel’s opening and closing arguments and actuated through the cross-examination of the Commonwealth’s witnesses, was that Smith “set up” the defendant. Defense counsel carefully and exhaustively questioned each officer, seeking to show that Smith was not searched completely in advance of each controlled buy and that his actions leading to and during the controlled buys were not under constant observation by surveillance officers. Defense counsel pointed out each occasion that Smith was out of the view of surveillance officers and of the video camera secreted on Smith. Counsel also pointed out that the video never showed the defendant handing anything to Smith, implying that Smith could have had possession of the cocaine all along. As the defense theory rested on the premise that the substances were cocaine, it supports a finding of harmless error. See Rodriguez, 75 Mass. App. Ct. at 243 (defense theory premised on substance to be that stated in certificates supports finding of harmless error); Commonwealth v. Greco, ante 296, 299-300 (2010) (defendant’s failure to contest nature of substance noted but not given much weight because, at time of trial, admission of certificates without opportunity to cross-examine analyst did not violate defendant’s constitutional rights). Contrast Charles, 456 Mass. at 383 (although defendant did not contest nature of substances, defense theory cannot relieve Commonwealth of its burden of proving nature of substances).
We are satisfied, given the overwhelming evidence of the nature of the substances, independent of the certificates, that the instant error was harmless beyond a reasonable doubt.12
Ineffective assistance of counsel. The defendant did not receive ineffective assistance of counsel. As the defendant’s contentions regarding the process by which Smith was approved as an informant, the prior bad act testimony, and the *876officers’s testimony regarding their gang task force affiliations did not constitute error, they cannot form the basis of a claim of ineffective assistance of counsel. Regarding the error resulting from the admission of the certificates, as the defendant has received the benefit of an analysis as if that error was preserved by an objection by counsel, there is no basis on which to conclude counsel’s assistance as ineffective on that issue.
Judgments affirmed.
following trial, under the bifurcated procedure required by G. L. c. 278, § 11 A, the defendant pleaded guilty to the subsequent offender portions of the indictments, G. L. c. 94C, § 32A(d). Under that procedure, a defendant is “required to be tried . . . first, on the underlying substantive crime and, then, in a separate proceeding, on that component of the charge referring to the crime as a second or subsequent offense.” Commonwealth v. Miranda, 441 Mass. 783, 787-788 (2004).
Geiger and Lockett were appointed as special Federal officers assigned to the western Massachusetts gang task force.
At that time, Smith was being held on a warrant for nonpayment of a motor vehicle fine.
The video portion of the recording was shown to the jury during the testimony of both Geiger and Smith. As it was shown, the prosecutor asked each witness to identify the action being displayed. (The parties had stipulated that the audio portion was inadmissible.)
Other officers had departed earlier to set up surveillance.
The defendant did not object to these instructions as given, nor request that any additional or different instructions be given.
The defendant’s claim of error rests upon the following testimony:
Prosecutor: “What assignment do you have?”
Trooper Geiger: “I work in the Massachusetts State Police Gang Unit. And I’m also attached to the FBI Gang Task Force.”
Prosecutor: “How are you employed, sir?”
Officer Lockett: “I’m employed by the Chicopee Police Department, currently assigned to the Western Mass Gang Task Force.”
Prosecutor: “Sir, back in 2006, were you working as part of the Gang Task Force?”
Officer Lockett: “Yes, sir.”
Prosecutor: “And did you participate with special agents Mark Karangekis and Christopher Dillon in terms of [the] initiative in the Mason Square area of Springfield?”
Officer Lockett: “Yes, I did.”
Prosecutor: “As part of that initiative, were you put in contact with a cooperating individual by the name of Charles Smith?”
Officer Lockett: “Yes, Sir.”
Prosecutor: “What was [the] nature of the investigation you were working on?”
Special agent Dillon: “It was part of [the] Mason Square initiative. It’s a gang case in which we were targeting certain individuals who were known to be trafficking, you know, participating in trafficking of illegal narcotics.”
The instant case was tried after the Supreme Judicial Court’s decision in Commonwealth v. Verde, 444 Mass. 279 (2005), and before the United States Supreme Court issued Melendez-Diaz, supra.
As noted in Vasquez, supra at 360 n.12, quoting from Commonwealth v. Tyree, 455 Mass. 676, 701 (2010), the following factors, although not exclusive or exhaustive, continue to be useful in guiding this decision, with the result to be determined by the circumstances of each case: “the importance of the evidence in the prosecution’s case; the relationship between the evidence and the premise of the defense; who introduced the issue at trial; the frequency of the reference; whether the erroneously admitted evidence was merely cumulative of properly admitted evidence;. . . and the weight or quantum of evidence of guilt.” See Commonwealth v. Mahdi, 388 Mass. 679, 696-697 (1983); Commonwealth v. Fluellen, 456 Mass. 517, 526 (2010).
In addition, defense counsel cross-examined Geiger extensively on the appearance of the substances purchased from the defendant and on the difference in appearance between “crack” and powder cocaine.
Although the judge did not make specific findings that Smith and Geiger were qualified to testify as to the nature of the substances, a judge is not required to make an explicit finding in the absence of a request by the defendant. See Commonwealth v. Little, 453 Mass. 766, 770 n.3 (2009).
As we have concluded that the admission of the certificates was the only error and that it was harmless, the defendant’s claim of cumulative error is without merit.